Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp173204lqs; Mon, 4 Mar 2024 20:38:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUIDgL0jSpM87nc8Jgo8blTuoT80yNpVzrnHQhFRE2QNFJJLknlbG31tnb7/F/UmKjD17mdrUPgwedTP9lX3FgP0NY/JpauCIPMgfyPbA== X-Google-Smtp-Source: AGHT+IGM6qZdf9AarXJNvt/K8Fs3YgCHW+6hpdtZKPqKFDIDekc4WBAhF45WDKbI00ftSg0wJjCH X-Received: by 2002:a17:906:f35b:b0:a44:19f2:1be1 with SMTP id hg27-20020a170906f35b00b00a4419f21be1mr8210556ejb.5.1709613505654; Mon, 04 Mar 2024 20:38:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709613505; cv=pass; d=google.com; s=arc-20160816; b=yzpqIaqnOGabw6BToh9Soe9dhJO+yePAEAbb2EtqQZpml4mRd4iWnMRvWwAU0DG2B6 hv/5QCtnmpnsJBTF33bv96LlqmNhvdV4qKIAo0BJ/atohyhpg+7hOPLoAglIFc96SnBs N8s74IopZenxXWFMOuVKc5xefj73RTtNAzoeLDqaIIp2Y017CCoo/xv6uVoFOBP4k3eq 0ZTgX1WOcgQ2Zuj0xYmnK4vxFkWBql3s8Gs0shx0cuQmY/+ehuhHM9fizx+kAqNMuNFm /mS6nHMPDIY3sZyWUEGi6M3CjIksfY/jmYHwBNfU/eZR6M+W13bFTawzd8pG2k2hzROg Gk6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nfxUijM98LodIyba5+CI8ZUutJ7Csal+zIka0IOO6Tc=; fh=mep51hfm/XZoNtXWrX5aARRfdaIVHGxhMbGOUdm4Jeo=; b=AgfJ9Aa6IC7A6VNlezK3z0dFzQidWJPOLsYUKqQID2hZrU4R05sOdoEkZlgP9gzByb If6T5LEd3/LMNJ8OYp9JokrQ5sl2DEpxNaoaB+a1Kr0UQBg4Jg6HO3N/cQmTwmBzLt23 G+F8aK3mxtRRNjs8sh2KpeqMJvbr97g8LfAGaC3yQSjcb1CIWq5grTUSkJ4AvlxxSS5g CJrS742GZ78O3P007neB+qJw959WQ8YaA6T958xlI1tvL+J6ZiWBt/mHQdBuKMcUSsxH H5luaFJPSUrvXO9a1kp/ec9I+Ww67xlNiolMOlv4LY+viy5njiBHK8ZcQ8AuNe0bvrUA k3eQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L1YXdS8E; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-91666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k7-20020a170906680700b00a3fc1f03ad2si4457325ejr.91.2024.03.04.20.38.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 20:38:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L1YXdS8E; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-91666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 648A71F22DED for ; Tue, 5 Mar 2024 04:38:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3189405F2; Tue, 5 Mar 2024 04:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="L1YXdS8E" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3100A4597D for ; Tue, 5 Mar 2024 04:38:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709613494; cv=none; b=bqfmgKQlf/SeYGGEHktr/FGtfZaXnEPD2JXUgxyaUXK7ZOqvKRT6TTX7cUGxMbUrdlcZhdlRuv+fYgDUPdyy2cNwPOLSy2NRDQucIZ3UqRNYOWqLuDVXjORvYdqdCcQhQAYRqTEhzycFz+3Bcq1LzIcZqVBYLDElYiH5ezPjtjw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709613494; c=relaxed/simple; bh=mP3X3VqEryKJoRkBgYXccDfgt61b1ycSS3VJoO/hS00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EhGBwtqGZT/ULsXzGOu9mbmZtGkhh24+NsfNZQBm9jZuFZCqN9jY0YmT5MH0bP+2fW9FLGYvtcYQB2/CAAxVMas+Xe3uOwVDkckV4p0LoVuf0MQHxJ3igfTpqFnu/oIUgrCC1yY2qbO9wnr28xq3Zlc9E5Av975S4+mdN77rWbc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=L1YXdS8E; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709613491; 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=L1YXdS8EmIO+i3wOgh3QvVlPUFclD8JHVdwFCEmlzMTwiB7yf774bSraB8jfi285xJk6Ex 4TGVt+JGAQLt24ofZqaTrkGYZ0ZiGLJfE3reZpnUIrYXPEMHaBh5kV8TWBBKcXQ4u+oBT3 gLulg0BYpSsyKaXTzgqoCYo/5aKKy1k= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 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 --- 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 -- 2.44.0