[PATCH 12/12] mm/memory_hotplug: drop CONFIG_HAVE_ARCH_PFN_VALID handling from pfn_to_online_page()
From: David Hildenbrand (Arm)
Date: Wed Sep 09 2026 - 09:59:30 EST
Drop CONFIG_HAVE_ARCH_PFN_VALID handling, as CONFIG_HAVE_ARCH_PFN_VALID
is never used with CONFIG_MEMORY_HOTPLUG, as the latter depends on
CONFIG_SPARSEMEM_VMEMMAP. Make sure it stays that way.
Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
---
mm/memory_hotplug.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b428da66d279c..58ce35cb48f57 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -344,6 +344,8 @@ struct page *pfn_to_online_page(unsigned long pfn)
struct dev_pagemap *pgmap;
struct mem_section *ms;
+ BUILD_BUG_ON(IS_ENABLED(CONFIG_HAVE_ARCH_PFN_VALID));
+
if (nr >= NR_MEM_SECTIONS)
return NULL;
@@ -351,13 +353,6 @@ struct page *pfn_to_online_page(unsigned long pfn)
if (!online_section(ms))
return NULL;
- /*
- * Save some code text when online_section() +
- * pfn_section_valid() are sufficient.
- */
- if (IS_ENABLED(CONFIG_HAVE_ARCH_PFN_VALID) && !pfn_valid(pfn))
- return NULL;
-
if (!pfn_section_valid(ms, pfn))
return NULL;
--
2.43.0