Re: [PATCH 12/12] mm/memory_hotplug: drop CONFIG_HAVE_ARCH_PFN_VALID handling from pfn_to_online_page()
From: David Hildenbrand (Arm)
Date: Thu Sep 10 2026 - 11:37:58 EST
On 9/10/26 16:47, Lorenzo Stoakes (ARM) wrote:
> On Wed, Sep 09, 2026 at 03:33:05PM +0200, David Hildenbrand (Arm) wrote:
>> 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.
>
> So argument is:
>
> mm/Makefile:
>
> memory-hotplug-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o
>
> Is memory_hotplug.c even compiled at all?
>
> mm/Kconfig:
>
> menuconfig MEMORY_HOTPLUG
> bool "Memory hotplug"
> select MEMORY_ISOLATION
> depends on SPARSEMEM_VMEMMAP
> depends on ARCH_ENABLE_MEMORY_HOTPLUG
> depends on 64BIT
> select NUMA_KEEP_MEMINFO if NUMA
>
> $ cd arch
> $ rg HAVE_ARCH_PFN_VALID
> Kconfig
> 1762:config HAVE_ARCH_PFN_VALID
>
> arm/Kconfig
> 94: select HAVE_ARCH_PFN_VALID
>
> arm/mm/init.c
> 121:#ifdef CONFIG_HAVE_ARCH_PFN_VALID
>
> arm/include/asm/page.h
> 178:#ifdef CONFIG_HAVE_ARCH_PFN_VALID
>
> m68k/Kconfig.cpu
> 23: select HAVE_ARCH_PFN_VALID
> 40: select HAVE_ARCH_PFN_VALID
>
> arc/Kconfig
> 463: select HAVE_ARCH_PFN_VALID
>
> All of arm, m68k and arc are 32-bit arches so by definition MEMORY_HOTPLUG
> can't be selected.
>
>>
>> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>
> So LGTM and:
>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@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));
>
> Haha nicest way of removing some later code I've seen. Just make it not compile
> if such a thing happens :)
Better be safe than sorry :)
Thanks!
--
Cheers,
David