Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp981365lqs; Wed, 6 Mar 2024 02:44:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVPYi1980il0ei5Thw+wQRI0euxFFu6n34gVVgnQ+AV1xgC2ubZLvwNFlGt7pRpGiQ8PFyc+A9+5d5ZmL48q16tv95x2NLALxYVJEMYhw== X-Google-Smtp-Source: AGHT+IEKIG4AwNO+5NeJKTQzbepsYNaQu0vo7ICWAjEjrh7KVi7S4HM1nCKmMLMzErdMNXTGm1lJ X-Received: by 2002:a05:622a:8b:b0:42e:fea1:8391 with SMTP id o11-20020a05622a008b00b0042efea18391mr5003646qtw.59.1709721864283; Wed, 06 Mar 2024 02:44:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709721864; cv=pass; d=google.com; s=arc-20160816; b=d7PL2Xn91U+z0Iar5MdPUA8qU6B+0G1OCrYTMzzpC/TDYQlldkymIWPsxB7PGVplga vKP1kqPpcn+iicdISOOAlPOELtpfz6/yIpRYzXVWI4giPlIB36ekMLMKT81pDHlQXo+w 1dpOfa4cBgurhh1dsVgDdgAtM657FZzUIwrYIVpxJCwekzaHqO9vmUaPhCoQYNuHgpes LnnHNgAWm9lNCd7q4ITGoG+E0IxQ006Hf7wRea3FeD4VBA7TU3xKH1vjMPhbqKSwBLRg /uwmbI+yKppRrYlNy8mzhlz17mkvY5VxS2wS09+3dlNeAJZZ7UxBzQ+74yQqdgm2uuBM zE/A== 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=Kmh1r8OzIBeRtjZdwvZUDbG8Rg7aEeeC8h0p+1IZUgI=; fh=E4E5uTADjz+/lsWz/ZLUY0Z5vZDWjJdnr8h/iHBZdn0=; b=XDh/BXzyp0LCof8rn4nXmGCDucQvKcFpySdrge4ksWLtzrmvQihiL6SUd4qfU+uPXN Pr6QUTunSFMHsehFKOMZl8lDyCDhiknAFoW9SWBBskaW177roVIpbuGmA1OMq9x94vh9 piWOp7pwTlRAMjMgUP0n6V43QyvwjRGETfcyUOxNMWb8Lrz3+Cd7MRTL4v5SjHAZc73a yuRTV4rD2kadkypSFWGQ4VAy9L97SoaLF0lv54ejWtNNz7i4GFG6lTU3Vlg4MQAKsZDU uCRXzN7/7Rq0LYcUZiUXX3o/aOTJFjHByn3/nbt9fVsfTKEX0Jl2WOEVkUszCP+/WDvd dCMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Hxj1hNGx; 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-93795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93795-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 k22-20020ac85fd6000000b0042ee9506c4bsi7942594qta.425.2024.03.06.02.44.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 02:44:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93795-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=Hxj1hNGx; 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-93795-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93795-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 0897F1C21B72 for ; Wed, 6 Mar 2024 10:44:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4E6360DE9; Wed, 6 Mar 2024 10:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Hxj1hNGx" 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 04EC660B92 for ; Wed, 6 Mar 2024 10:43:15 +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=1709721798; cv=none; b=GRxAxaZl/qhJ88R5YsiACRSFYGSFopd8sBOn9kmfdD5Tc0juIiq7CQ1QunUe9vwiAsNurYhM2694/78l2XqGLVMaAi2beY/jrq45r7xOu86qBnv2e/mQrDmbLvuoKr/d1y5lGM5ExvMBfjcufz15SMGOMRP7DeGMbyl2dXD8c9c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721798; c=relaxed/simple; bh=X5eBBmskEGNOVvFH7lA9BrgRznTJLWM2S1lsxZlH7is=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oACt4dtxERGfCMEiHAQCrwlnD/ooAcZzWCXGeTsl4IHLrYlLVHMyrK4q+gca2aBZhBvXw3H4JZjprDSpF4fVF8XDbo3qzxC+7JmZIKlHzfHVjAeAQ8crVXbfK+C9VXyi5I5alxR1YONNWG4iE5fgI47+UnRCjvTOizNMKOvFgVM= 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=Hxj1hNGx; 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=1709721795; 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=Kmh1r8OzIBeRtjZdwvZUDbG8Rg7aEeeC8h0p+1IZUgI=; b=Hxj1hNGxRJMETCCA/wKYgwPWC62Y01gSGws7iVKQMmo/HFJ2L9Q/ZlSdPNX0UCTQtjYruY 2UsmBkLvN8NQqc90axY12YNUI40w+XqamrN5YLJRlb5ZezPlfsMNvmjaxIr2tLtKjmrNvz NcPE5Ys0c0SxG6PSqMqvMdycpl9EEHM= 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-132-28RiKZlpPQu-76jARwQEkw-1; Wed, 06 Mar 2024 05:43:10 -0500 X-MC-Unique: 28RiKZlpPQu-76jARwQEkw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 13B1C8007A7; Wed, 6 Mar 2024 10:43:10 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 294B5111DD03; Wed, 6 Mar 2024 10:43:01 +0000 (UTC) From: peterx@redhat.com To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Andrew Morton , Muchun Song , Jason Gunthorpe , peterx@redhat.com, Matthew Wilcox , Mike Rapoport , Christophe Leroy , x86@kernel.org, sparclinux@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Ellerman , Nicholas Piggin , "Aneesh Kumar K.V" , "Naveen N. Rao" Subject: [PATCH RFC 09/13] mm/powerpc: Redefine pXd_huge() with pXd_leaf() Date: Wed, 6 Mar 2024 18:41:43 +0800 Message-ID: <20240306104147.193052-10-peterx@redhat.com> In-Reply-To: <20240306104147.193052-1-peterx@redhat.com> References: <20240306104147.193052-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.3 From: Peter Xu PowerPC book3s 4K mostly has the same definition on both, except pXd_huge() constantly returns 0 for hash MMUs. AFAICT that is fine to be removed, because pXd_huge() reflects a hugetlb entry, while it's own hugetlb pgtable lookup function (__find_linux_pte() shared by all powerpc code) already use pXd_leaf() irrelevant of the MMU type. It means pXd_leaf() should work all fine with hash MMU pgtables or something could already went wrong. The goal should be that we will have one API pXd_leaf() to detect all kinds of huge mappings. AFAICT we need to use the pXd_leaf() impl (rather than pXd_huge() ones) to make sure ie. THPs on hash MMU will also return true. This helps to simplify a follow up patch to drop pXd_huge() treewide. 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-4k.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/pgtable-4k.h b/arch/powerpc/include/asm/book3s/64/pgtable-4k.h index 48f21820afe2..92545981bb49 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable-4k.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable-4k.h @@ -8,22 +8,12 @@ #ifdef CONFIG_HUGETLB_PAGE static inline int pmd_huge(pmd_t pmd) { - /* - * leaf pte for huge page - */ - if (radix_enabled()) - return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE)); - return 0; + return pmd_leaf(pmd); } static inline int pud_huge(pud_t pud) { - /* - * leaf pte for huge page - */ - if (radix_enabled()) - return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE)); - return 0; + return pud_leaf(pud); } /* -- 2.44.0