From nobody Fri Dec 19 18:55:54 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 A3E7032D7E0 for ; Mon, 15 Dec 2025 21:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765833447; cv=none; b=V69yvJ4s08aetixeeRLkIvxKj+OmeHOQxKiSALLEvzndeqCYLoYYo5gXkI7fsea+cJsScZRwmBfCxqtNKmW3jMQ/AABA32LM8T4w3wZ3BjX1vd9P8BOe4hPWz2BOThKhfUxzjv6Lnx81uPg0nVlDB1HYpBipeYWMYn1+NUM+8bs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765833447; c=relaxed/simple; bh=MCcuNR6IakKvLrCXRJv1/i3NTlULZAv9y3cr1RZJf5g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RmVXaFJbL3Kkern/EsivBS/BHOTV5vrUM3S3CQcPw6GM23ZjA0abOaxMGzF0SV3BscKk/Q88Tph3TDEoB50JHxhaJM6XsVi1Gvvl7i2TDkJpAaUsWBbKtIub7jvPpuFa6uV23CY32db/25Af6C42z6Qp33wwyn3hG93e4sQe+6M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=crPRYeyu; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="crPRYeyu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765833444; 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=PTSOH2pctXhaKsGHgvQmmsRPhPghSOFVRWwpawQqEhA=; b=crPRYeyu8hFL4+4eXMN0zmabMakVlqAr5KhRiK6kBFRoQUhpG/aS3KUcoG8BMX8PokuMQS YeTOtbZX6F1crXi/o2mhZXjI/QNUWDnG8Ri+RgAmekslOFW3e48BElhgqvxQVgQ8yWnYD9 55EyaKr6sds4w3WpOwimarFr2sRM4ew= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-127-ZCqkKNbwPXKyRb718mBwbQ-1; Mon, 15 Dec 2025 16:17:21 -0500 X-MC-Unique: ZCqkKNbwPXKyRb718mBwbQ-1 X-Mimecast-MFC-AGG-ID: ZCqkKNbwPXKyRb718mBwbQ_1765833440 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 46AD61800245; Mon, 15 Dec 2025 21:17:20 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.80.180]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 244601955F21; Mon, 15 Dec 2025 21:17:19 +0000 (UTC) From: Luiz Capitulino To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, david@kernel.org Cc: ryan.roberts@arm.com, akpm@linux-foundation.org, lorenzo.stoakes@oracle.com Subject: [PATCH 11/11] mm/thp: x86: cleanup PSE feature bit usage Date: Mon, 15 Dec 2025 16:16:53 -0500 Message-ID: <327e07e0ff3579857b11d14c837ac6231cd113b4.1765833318.git.luizcap@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" 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 can enable 2 MiB or 4 MiB page sizes so it must be checked. To clean this up, this commit: 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 by implementing 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 =20 -#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/pgtab= le_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) =20 +#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__ */ =20 /* --=20 2.52.0