From patchwork Wed Feb 28 08:53:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13575058 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 274F3C54E41 for ; Wed, 28 Feb 2024 08:54:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B60D66B00A1; Wed, 28 Feb 2024 03:54:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B110B6B00A2; Wed, 28 Feb 2024 03:54:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D9386B00A3; Wed, 28 Feb 2024 03:54:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8F6666B00A1 for ; Wed, 28 Feb 2024 03:54:15 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5906D160EDB for ; Wed, 28 Feb 2024 08:54:15 +0000 (UTC) X-FDA: 81840600870.13.484DF12 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 9F0D5100016 for ; Wed, 28 Feb 2024 08:54:12 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=btVNBvmO; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf14.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=1709110452; 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=9UyoXi+HwlVtJP+87NSGPs1pMI8Qh3FSYjQ5NAjm12k=; b=b3FCbrBRqGGOoUasg1hlwsqLOPkf8SysUoQzT9d+RdNNFNSdFr9enXP6Cwp+xZKaouT+HJ FNBj77FbtCuBIc9t+RYyhy2rOHjR69f8ZM6m/s4nnVORTk39mbIl8k2MVqJb1eS/U1J7fi RQMlHDg9uYBEFwShcGMK8NFJUzDgGwY= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=btVNBvmO; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf14.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=1709110452; a=rsa-sha256; cv=none; b=ZFXHMx8e/97BrcaEPnw/d2mI03jlVWDFy3/VbTBwu8/Xl6f99nt5Qm9XHRrWlHDmK5U3kR eyOgOVHBYQ98JNLxb0Ya45NyCO7Y2vbyyU6owvjGfc9aIJ/d8se9snALP6uTtVogFgH3yy lLcDFvLrXxxE4OrIVyLPp7fNIChJIv8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709110452; 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=9UyoXi+HwlVtJP+87NSGPs1pMI8Qh3FSYjQ5NAjm12k=; b=btVNBvmOVixTSQyQlYpLvAkWjgXyqJ/j3+F2egP6+qBAwqmvxWSKX7pfvK7ARw1DYCuUtF S7IaO/jkUioTtsSciyXds7xfHMqxAq8sV7pxnZXrxqudC10vDvc7K4vQDiy5XZYgccRgM1 bTYHPhCKg+XwErFcZibsA/fyuxNTiPE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-290-HCv9n8T2MZCG0tEH5MRMGw-1; Wed, 28 Feb 2024 03:54:07 -0500 X-MC-Unique: HCv9n8T2MZCG0tEH5MRMGw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 A906C108BFC9; Wed, 28 Feb 2024 08:54:06 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A240200A382; Wed, 28 Feb 2024 08:53:58 +0000 (UTC) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Yang Shi , Muchun Song , Jason Gunthorpe , x86@kernel.org, "Kirill A . Shutemov" , linuxppc-dev@lists.ozlabs.org, Andrew Morton , peterx@redhat.com, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" Subject: [PATCH 1/5] mm/ppc: Define pXd_large() with pXd_leaf() Date: Wed, 28 Feb 2024 16:53:46 +0800 Message-ID: <20240228085350.520953-2-peterx@redhat.com> In-Reply-To: <20240228085350.520953-1-peterx@redhat.com> References: <20240228085350.520953-1-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Rspamd-Queue-Id: 9F0D5100016 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: kxqijfm99xn7up8hwgg3yfs7opo1517i X-HE-Tag: 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EtP6MyDN3k6nZdmudyFiaAp+sQIOnsqFrHfEm1Ou/bqjOGA2cCLUhguQ4LkqDrTDMzT9kzT370rt4PaTYaxKJhU7UwLHI49vxsCd+xps0VgNQD/6RjBoB0CJ1lS9tQ9Sr/yHsDt4CYvAIZFsRhrcq8ENxX4OrvzFSPIj/vbQb6WxcZKVJXxSQ2TXCdWwga9NBPLnQR4ryTttTuMSbwxW7I4+S+Sn86kK5nNrgOjy/zNEVTnNpMeja44nQmAb8V0QpNb9PIAj+oam1KwP9QHXpbHubJ3UeOFjIY4tu01VCCcAUrwhtlGYGHBRYImouoOB8etB8Jb+HXAAhK4zEiMlhRT7gNBvttI7VCVxy/4thcrCruk+zu0Cl 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: linuxppc-dev@lists.ozlabs.org Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: "Aneesh Kumar K.V" Cc: "Naveen N. Rao" Signed-off-by: Peter Xu --- 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