[PATCH v2 1/2] x86/mm: support memory-failure on 32-bits with SPARSEMEM

Xie Yuanbin
2025-11-04T07:23:15Z

The historical commit d949f36f1865c60239d4 ("x86: Fix hwpoison code
related build failure on 32-bit NUMAQ"), disabled x86_32's
memory-failure when SPARSEMEM is enabled, because the number of
page-flags are insufficient.

The commit 46df8e73a4a3f1445f2a ("mm: free up PG_slab") removes PG_slab
flag that allows MEMORY_FAILURE to be enabled from here on.

The commit 09022bc196d23484a7a5 ("mm: remove PG_error") removes PG_error
flag.

The commit cceba6f7e46c48deca43 ("mm: add PG_dropbehind folio flag") add
PG_dropbehind flag, but MEMORY_FAILURE can still be enabled.

For the current version, for x86_32, when SPARSEMEM && HIGHMEM && X86_PAE
&& X86_PAT, the number of pageflags reaches its maximum value,
which is 31. Therefore, MEMORY_FAILURE can be safely enabled.

Signed-off-by: Xie Yuanbin <xieyuanbin1@huawei.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dave Hansen <dave.hansen@intel.com>
---
arch/x86/Kconfig | 3 ---
1 file changed, 3 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d55c01efd7c2..f9ee57a55500 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -750,13 +750,10 @@ config IOSF_MBI_DEBUG

config X86_SUPPORTS_MEMORY_FAILURE
def_bool y
# MCE code calls memory_failure():
depends on X86_MCE
- # On 32-bit this adds too big of NODES_SHIFT and we run out of page flags:
- # On 32-bit SPARSEMEM adds too big of SECTIONS_WIDTH:
- depends on X86_64 || !SPARSEMEM
select ARCH_SUPPORTS_MEMORY_FAILURE

config X86_32_IRIS
tristate "Eurobraille/Iris poweroff module"
depends on X86_32
--
2.51.0