From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A89E32E92D2 for ; Mon, 17 Nov 2025 17:49:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763401771; cv=none; b=unHJ+tkyapFei/7VJp4PeY5I05y9ldEB6T+j/jOkhY1TD+E0r+/zr2IR8fATm70cH5xlxQUtmcBb92iGhhqJ75qy/Kcygvo9wYiu4yg6VsjGI4KNb+tKKvN3pjingW24o/je9GFHW0Rscg/kI6gSCBGKPjoyWPtV8ua8vwxbPEM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763401771; c=relaxed/simple; bh=sw/VEsI4xwBHTiS4b7CI6sSKdSRzzaJkWSJ08JK4UPc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FFBQNs3HZIOlpRlFu6Gw3mVsFWBhQg3ZCL83SvsVXmsWlo/NtVsJBwLIX70yaJ1AYBAgqacE8kFXiEl1DJcvfXVblWy06Cga+ut17AteiTiqpwsL3VK00mHXMQzVvx29oBHXBLPfLtRoDChmUqzxqY3RVPZLStF+iKeqJXEixyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CRd80XJu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CRd80XJu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CFF1C2BCB4; Mon, 17 Nov 2025 17:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763401770; bh=sw/VEsI4xwBHTiS4b7CI6sSKdSRzzaJkWSJ08JK4UPc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=CRd80XJu4jzPfgRemoUpSPvnlDpOt6p8SiVSIodbS0bDi0kGr+YZ5ibn5VdzOaJNM xiAXeBUC5V/lY2oUvsNwb0x0hC1gZFdS5b32Fvuy2m0r+4F3mr3Ug2rYZC9YrpPxTb Z6yLUxIN5yxQylOFZlgX6yUk9ewEqI5oYQIGfmuFmu17ejORnfArdkkjJApftjTFFJ 7v0WQCMZLeBOoz20FSd6EaPvcb8VaVCD9jobDAmTk0AXFIkvRIm3ri4nEDcyAwMbGp hkjPUyh+74oprkN24Ty/8egYZiEmmwydtwIdd2O6kCJrEpepuwJHbiGdFZZWK3Gpx6 jfq9UNShdFC/A== Message-ID: <58caeb32-f50a-4056-828a-476d958955ad@kernel.org> Date: Mon, 17 Nov 2025 18:49:26 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC 10/10] mm: thp: x86: cleanup PSE feature bit usage To: Luiz Capitulino , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: ryan.roberts@arm.com, akpm@linux-foundation.org, lorenzo.stoakes@oracle.com References: <8dc0695aa1c1073ec475be18e300ec1046344e84.1762464515.git.luizcap@redhat.com> From: "David Hildenbrand (Red Hat)" Content-Language: en-US In-Reply-To: <8dc0695aa1c1073ec475be18e300ec1046344e84.1762464515.git.luizcap@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 06.11.25 22:28, Luiz Capitulino wrote: > Historically, THP support on x86 checked the PSE feature bit to enable > THP. On 64-bit, this check is redundant since PSE is always enabled by > default for compatibility. On 32-bit, PSE enables 4MB page support and Or 2MB support with 4byte PTEs I guess? > must be checked. To clean this up, this commit: > Likely the subject should start with: "x86/mm:" > 1. Drops arch_has_pmd_leaves() from common x86 code. For 64-bit, > we assume PMD-sized pages are always supported > > 2. Checks for PSE only on 32-bit, using arch_has_pmd_leaves() > > Signed-off-by: Luiz Capitulino > --- > arch/x86/include/asm/pgtable.h | 6 ------ > arch/x86/include/asm/pgtable_32.h | 6 ++++++ > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h > index 08d109280e36..55b88de5178f 100644 > --- a/arch/x86/include/asm/pgtable.h > +++ b/arch/x86/include/asm/pgtable.h > @@ -313,12 +313,6 @@ static inline int pud_trans_huge(pud_t pud) > } > #endif > > -#define arch_has_pmd_leaves arch_has_pmd_leaves > -static inline int arch_has_pmd_leaves(void) > -{ > - return boot_cpu_has(X86_FEATURE_PSE); > -} > - > #ifdef CONFIG_ARCH_SUPPORTS_PMD_PFNMAP > static inline bool pmd_special(pmd_t pmd) > { > diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h > index b612cc57a4d3..3bd51cfa431e 100644 > --- a/arch/x86/include/asm/pgtable_32.h > +++ b/arch/x86/include/asm/pgtable_32.h > @@ -45,6 +45,12 @@ do { \ > flush_tlb_one_kernel((vaddr)); \ > } while (0) > > +#define arch_has_pmd_leaves arch_has_pmd_leaves > +static inline int arch_has_pmd_leaves(void) > +{ > + return boot_cpu_has(X86_FEATURE_PSE); > +} > + > #endif /* !__ASSEMBLER__ */ > > /* Right, IIUC 64bit should neve rrequire this check. -- Cheers David