[PATCH v2 13/13] mm/memory_hotplug: drop CONFIG_HAVE_ARCH_PFN_VALID handling from pfn_to_online_page()

From: David Hildenbrand (Arm)

Date: Mon Sep 21 2026 - 16:12:56 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.

Reviewed-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
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 d7a59167bec43..796af1028ee23 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -345,6 +345,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;

@@ -352,13 +354,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