Re: [PATCH 09/14] mm/sparse: remove CONFIG_MEMORY_HOTPLUG-specific usemap allocation handling
From: Mike Rapoport
Date: Wed Mar 18 2026 - 04:39:48 EST
On Tue, Mar 17, 2026 at 05:56:47PM +0100, David Hildenbrand (Arm) wrote:
> In 2008, we added through commit 48c906823f39 ("memory hotplug: allocate
> usemap on the section with pgdat") quite some complexity to try
> allocating memory for the "usemap" (storing pageblock information
> per memory section) for a memory section close to the memory of the
> "pgdat" of the node.
>
> The goal was to make memory hotunplug of boot memory more likely to
> succeed. That commit also added some checks for circular dependencies
> between two memory sections, whereby two memory sections would contain
> each others usemap, turning bot memory sections un-removable.
^ typo: boot
>
> However, in 2010, commit a4322e1bad91 ("sparsemem: Put usemap for one node
> together") started allocating the usemap for multiple memory
> sections on the same node in one chunk, effectively grouping all usemap
> allocations of the same node in a single memblock allocation.
>
> We don't really give guarantees about memory hotunplug of boot memory, and
> with the change in 2010, it is pretty much impossible in practice to get
> any circular dependencies.
>
> commit 48c906823f39 ("memory hotplug: allocate usemap on the section with
> pgdat") also added the comment:
>
> "Similarly, a pgdat can prevent a section being removed. If
> section A contains a pgdat and section B
> contains the usemap, both sections become inter-dependent."
>
> Given that we don't free the pgdat anymore, that comment (and handling)
> does not apply.
>
> So let's simply remove this complexity.
>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> ---
> mm/sparse.c | 100 +---------------------------------------------------
> 1 file changed, 1 insertion(+), 99 deletions(-)
--
Sincerely yours,
Mike.