Re: [PATCH] mm/memory hotplug/unplug: Optimize zone contiguous check when changing pfn range
From: David Hildenbrand (Arm)
Date: Thu Mar 26 2026 - 05:59:47 EST
On 3/26/26 08:38, Chen, Yu C wrote:
> On 3/26/2026 3:30 PM, Liu, Yuan1 wrote:
>>> -----Original Message-----
>
> [ .... ]
>
>>
>> Btw, can we introduce a new kernel command-line parameter to allow
>> users to select
>> the memory block size? This could also address the current issue.
>>
>> Test Results as below, memory block size 128MB Vs. 2GB
>> +----------------+------+---------------+--------------+----------------+
>> | | Size | 128MG | 2GB | Time Reduction |
>> | +------+---------------+--------------+----------------+
>> | Plug Memory | 256G | 10s | 3s | 70% |
>> | +------+---------------+--------------+----------------+
>> | | 512G | 36s | 7s | 81% |
>> +----------------+------+---------------+--------------+----------------+
>> +----------------+------+---------------+--------------
>> +----------------+
>> | | Size | 128MG | 2GB | Time Reduction |
>> | +------+---------------+--------------+----------------+
>> | Unplug Memory | 256G | 11s | 3s | 72% |
>> | +------+---------------+--------------+----------------+
>> | | 512G | 36s | 7s | 81% |
>> +----------------+------+---------------+--------------+----------------+
>>
>> And I see the UV system has already this (Kernel parameter is
>> uv_memblksize).
>> I think if we can introduce a common kernel parameter for memory block
>> size configuration?
>>
>
> Is it possible to turn uv_memblksize into a generic commandline
> memblksize without
> introducing extra parameter?
We don't want that, and it's kind of a workaround for the problem. :)
I think we would want to only account pages towards
pages_with_online_memmap that fall within the zone span.
We will not account pages initialized that are outside the zone span.
Growing the zone and later trying to shrink them will only possibly see
a "too small" pages_with_online_memmap value. That is fine, it simply
prevents detecting "contiguous" so it's safe.
We can document that, and in the future we could handle it a bit nicer
(e.g., indicate these pages as being just fill material).
So indeed, I guess we want to teach init_unavailable_range() to only
account towards zone->pages_with_online_memmap whatever falls into the
zone span.
That could be done internally, or from the callers by calling
init_unavailable_range() once for the out-of-zone range and once for the
in-zone-range.
--
Cheers,
David