From patchwork Tue Mar 5 04:37:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13581594 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88844C54798 for ; Tue, 5 Mar 2024 04:38:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 08BFA6B007D; Mon, 4 Mar 2024 23:38:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 03BA26B007E; Mon, 4 Mar 2024 23:38:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E46026B0080; Mon, 4 Mar 2024 23:38:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D67CE6B007D for ; Mon, 4 Mar 2024 23:38:14 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 79284140190 for ; Tue, 5 Mar 2024 04:38:14 +0000 (UTC) X-FDA: 81861728508.21.8E074E1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id E59DE8000B for ; Tue, 5 Mar 2024 04:38:12 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OlAcvFxp; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709613493; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nfxUijM98LodIyba5+CI8ZUutJ7Csal+zIka0IOO6Tc=; b=dCr9tfnCieWwGyVHBceN8y24q1N7q0GWWaSwCFKDh/Zekuk6yts2U6n1+D89xaKpfprPa5 rIF/WrCnYKprc3OkcIauVyem6j40bQG/KEXTOzW4ocxEbGxkcR/tXMJ9ZBPZxR+HPpjZL5 1Fz/mXGu7FhLblwExByjGRwMCCxBamc= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OlAcvFxp; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709613493; a=rsa-sha256; cv=none; b=T7voTFdIZSmVWFCGlrEelsyLTvCMWKJ/W4hmz2PBf04hgoaynFOfTQ24olfzD5fLX+PC+1 +qwSNEgVfunHWn8jBAqv3gAFSsIgtfAML87fO8jc5MDpyprj4sLXcXpcexy4feO6K0js+1 D8P+imFjBYCObiYVKwBvMU/f+a1iulY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709613492; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nfxUijM98LodIyba5+CI8ZUutJ7Csal+zIka0IOO6Tc=; b=OlAcvFxpR7wZ0PHFINORqfVT3RLaCh1Jtq6sexJ2VM3GXaTGca0zH0E0b6Pm5wP5y+zrK/ tE/f0Jj7XIa5eZP3YUxQjvxLo/a/ThqcaznsKOX1JhHqwYEajAEiUDsjaqb2hpSgspsH+7 yEz1hnNR/vn1MCwu2/djY8FXDGQumGw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-496-1mgMvO_SNvuQIAWUTzmW_w-1; Mon, 04 Mar 2024 23:38:07 -0500 X-MC-Unique: 1mgMvO_SNvuQIAWUTzmW_w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB1381C07243; Tue, 5 Mar 2024 04:38:06 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD633C1F090; Tue, 5 Mar 2024 04:37:59 +0000 (UTC) From: peterx@redhat.com To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Christophe Leroy , x86@kernel.org, "Kirill A . Shutemov" , Jason Gunthorpe , Yang Shi , peterx@redhat.com, Andrew Morton , linuxppc-dev@lists.ozlabs.org, Muchun Song , Michael Ellerman , Nicholas Piggin , "Aneesh Kumar K.V" , "Naveen N. Rao" Subject: [PATCH v3 01/10] mm/ppc: Define pXd_large() with pXd_leaf() Date: Tue, 5 Mar 2024 12:37:41 +0800 Message-ID: <20240305043750.93762-2-peterx@redhat.com> In-Reply-To: <20240305043750.93762-1-peterx@redhat.com> References: <20240305043750.93762-1-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: E59DE8000B X-Stat-Signature: e9qzpw1pb16y4pge7tkerogr6efnndje X-Rspam-User: X-HE-Tag: 1709613492-419885 X-HE-Meta: U2FsdGVkX1/7KCIC/u53nieYafvwzUjmYwAEzFf4rZQAjiEDZOo8UTvoP/1Jg5F17qxFQZQA/mmoFlh2DyCGXBNZTRAB3eH6PzBTeQ/BSnPbIqbiGGpMUthcYTtsrxSq8zEsDuE4xkEiiUCQCMQWqBclcFVGlLuMu2X9Zhm+HFTkuyo384u/qw0u43YYPW/+bET9PyK5N4u7FZYTAtaAMnwxEtQm8bz3/jbchuBZ8xPceSpco38OsMF6xRK+uWfIx/MwmGqIQF2cCo5Tefk00qMuoMg2wP0qfgcE8gSCSd6XIrQ4+rZ9QB0lbQLR49UBvGLev5AQlbsEGLm2fFZWO2uubm7KHLzmFCdzAr7AOTl541TXOvlymj4E8Y3+zo60rydcbk9V7xhAZDngh7L88WMZRWGQn6nyCW71K2gvTj8mzy/dm0REiy00OBEFkgUlgtrehJqQkQ4UE+6RwkGi1eP08FCIsPMZ9cTWfydGqHTqyz0f3oSwswE3nbt+9VyJmYhnlzDgugdNi4aWyg575R3sOHuUWQ737PzuQcLx4Rwl5BuZRXtLupNHO/BmCcgSm0DEW1cnwbgjI3JEHjJEA0U11Q+9arxUPzxsh7m4qWQsGg6oVaYOEFqH0qk7xyT4m7uRjGwqg2WM/Ti3M+ixkn8fHOp82OGNb2c+RzdfeOImXBbs6t5pYv/GrX8yWACqKZznhHxO+76jgRai4TAapXbeNXffx3xESmY5QjwjznlBZfIwOBzLCe3JqEE/M/SBL79V+/CNk6dgHdBudG6dL968dOw5xzDFTcvQrS+4LOUVM/yFOKttJQBI+gs6JHxOCjBaUSP+GUjS0YpN6DJ2fYrDQ35Jkl947g7uwtBCgNpXwh8xCw2uei9vAb4GlyY2wsnuJmNJUSZIqHpKxL5J5cAKndcTECHwgoncHsngN5yz943gQYkyJNKXRADNLH17 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Peter Xu The two definitions are the same. The only difference is that pXd_large() is only defined with THP selected, and only on book3s 64bits. Instead of implementing it twice, make pXd_large() a macro to pXd_leaf(). Define it unconditionally just like pXd_leaf(). This helps to prepare merging the two APIs. Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: "Aneesh Kumar K.V" Cc: "Naveen N. Rao" Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Jason Gunthorpe Signed-off-by: Peter Xu Reviewed-by: Christophe Leroy Reviewed-by: Mike Rapoport (IBM) --- arch/powerpc/include/asm/book3s/64/pgtable.h | 16 ++-------------- arch/powerpc/include/asm/pgtable.h | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 927d585652bc..d1318e8582ac 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -1157,20 +1157,6 @@ pud_hugepage_update(struct mm_struct *mm, unsigned long addr, pud_t *pudp, return pud_val(*pudp); } -/* - * returns true for pmd migration entries, THP, devmap, hugetlb - * But compile time dependent on THP config - */ -static inline int pmd_large(pmd_t pmd) -{ - return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); -} - -static inline int pud_large(pud_t pud) -{ - return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE)); -} - /* * For radix we should always find H_PAGE_HASHPTE zero. Hence * the below will work for radix too @@ -1455,6 +1441,7 @@ static inline bool is_pte_rw_upgrade(unsigned long old_val, unsigned long new_va */ #define pmd_is_leaf pmd_is_leaf #define pmd_leaf pmd_is_leaf +#define pmd_large pmd_leaf static inline bool pmd_is_leaf(pmd_t pmd) { return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); @@ -1462,6 +1449,7 @@ static inline bool pmd_is_leaf(pmd_t pmd) #define pud_is_leaf pud_is_leaf #define pud_leaf pud_is_leaf +#define pud_large pud_leaf static inline bool pud_is_leaf(pud_t pud) { return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE)); diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 7a1ba8889aea..5928b3c1458d 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -101,7 +101,7 @@ void poking_init(void); extern unsigned long ioremap_bot; extern const pgprot_t protection_map[16]; -#ifndef CONFIG_TRANSPARENT_HUGEPAGE +#ifndef pmd_large #define pmd_large(pmd) 0 #endif