Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp340885rbe; Thu, 29 Feb 2024 00:43:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVm6sXLJzAE6kVjbVvPDuNMzDlj/gPANmaJ3gaRA6tl8TEfPD/AbuNIZjpxT4kbNZQhmCMSTBmK9x8BHRVgtwpKN2HnANqr/K5+aj/U7g== X-Google-Smtp-Source: AGHT+IGdks702nYRuXbYDT9SSPjYvY/eQTI4WAoaDikKeTu0AQpnDbYEuEW4IB8Ma0iBOkGFruVK X-Received: by 2002:a05:620a:10ae:b0:787:caf2:e1c1 with SMTP id h14-20020a05620a10ae00b00787caf2e1c1mr1366810qkk.41.1709196239342; Thu, 29 Feb 2024 00:43:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709196239; cv=pass; d=google.com; s=arc-20160816; b=pdJFMkjbCSt+1sIGLbMoBNe9sUWndEPTLvtWkNfQBUUBjbLLHr0wwCjDhvBRmmQqn7 iwrqk+qEXUtVPqCiCURT4ugCT+0Th1YiMoYFCffjY2Scnv9K+320niRd93MekvsLMMsM 7/rvsRL/YoBctBr7EnzPgCIfJI05lN/IDrPybZMi4yNKkNTs6rEaZWPmmI0CDU2kbjeV ugPGSBn3OKP7MTdMkwZcVZfLSQC90X+4lXvfXZyNzScxQVFwBWvgib2dwRS0k1KVhJ+L uWqK0D9XhE32ir3zdkgHB9vYeb698WOxpoo0GYL5g3pMEhgv/h7ouq6bi/4mz+1yid8Y fwyw== 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=ZJJ0eqDZ1S0vUv+Nro3fA2Y1PjBXchWPHo5qT9tenrk=; fh=WpTd0HURIQDJ4tmS1qXYN1s7aWLA/yvN9q8UvpbFb4A=; b=UZwj3okdOm/JMjZSjU3Jp4GX9zBabDGaXwAtXIomT3tKtpP9KWMUWSg5DH8uVTLrdS LtK3QMdVYkVBS8sB6EZbIuB2YVGF589tcur0aPGp3aVBewBnx4jLwHm7TrgtZuFiq4kc O4L3yVnwIg1Ek7cthcU4CUBY4viT0sH3VWO7afZ8aI52RGGxe2oce1GO/q+5MNQxg7H0 YnLBcmlxWoqcalT6AJu56vixJ7yC1gR7cFJbnY7EaFFyAPvijuIC4QV2vsfy0hZhbLv9 mOloDQPf1IZfsVvvR/X4G0FUcUWtil+mqWgDrQycaDfDO3z2niT0aToKhxO3U9IVR0nP lGLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UWxzOF75; 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-86327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86327-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o3-20020a05620a110300b00787c959b572si931368qkk.497.2024.02.29.00.43.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 00:43:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UWxzOF75; 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-86327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86327-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 09D2C1C22151 for ; Thu, 29 Feb 2024 08:43:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1092F535B0; Thu, 29 Feb 2024 08:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UWxzOF75" 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 C30EB53370 for ; Thu, 29 Feb 2024 08:43:22 +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=1709196204; cv=none; b=NLQo1l129aDQx3ydIE0dACDOMa21aCD0yPTEKU8ZWBl3KUSWXCg+NSXsepZK3UQxnHcPeiHcQuGk1aGn9X3tw2bMIZYHfTtv9FwPWSk9FzBTFT3+cjM2kd+KU8AhIv2MrhJH1ygJeeBOAa8f4E8Ucs344TiDsdaswM6wn4NyNeI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196204; c=relaxed/simple; bh=SujJ/twmkReQj+vxUjlVWk0iurtcUwJy8YcxyG1MwjE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C6+3eOnwy3H/8aRM466I+8sVH4JeNfsO9Ns8eqZVW2Zw0HNjN3GsFzIM3jkQnnGytX/cbRMlpjIUVGYsqM8LAsMYGYQ8zArLZ7JFMrJJvwmY9TzeBHANvlsfAAlvwiaf0ROsUcV0JYMKxATKVpY431CyjlG+VdASLlilEjjlzAg= 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=UWxzOF75; 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=1709196201; 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=ZJJ0eqDZ1S0vUv+Nro3fA2Y1PjBXchWPHo5qT9tenrk=; b=UWxzOF754cvxC8AoFyBGc5/ffjDxENjD/GvMWhP5tTxfI97hv7ho4ugh+0UvgDc/2+ZauS Y9+8b+T0t5PDLvQjC0l/XZoTqWAFX4RALa9xK9R7XuQJ0NfoWeozEzdua0HUAJ5tPfIRiA N8rL61A0GR5WmzUy7NlRiEytb8VDRn0= 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-160-nrzUiLqfPF6NDPYG9jg0YA-1; Thu, 29 Feb 2024 03:43:15 -0500 X-MC-Unique: nrzUiLqfPF6NDPYG9jg0YA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 7393383BA86; Thu, 29 Feb 2024 08:43:14 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7863E28D; Thu, 29 Feb 2024 08:43:07 +0000 (UTC) From: peterx@redhat.com To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Yang Shi , "Kirill A . Shutemov" , Jason Gunthorpe , peterx@redhat.com, Muchun Song , Andrew Morton , x86@kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" Subject: [PATCH v2 1/7] mm/ppc: Define pXd_large() with pXd_leaf() Date: Thu, 29 Feb 2024 16:42:52 +0800 Message-ID: <20240229084258.599774-2-peterx@redhat.com> In-Reply-To: <20240229084258.599774-1-peterx@redhat.com> References: <20240229084258.599774-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.1 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 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.43.0