[PATCH 01/49] mm/sparse: fix vmemmap accounting imbalance on memory hotplug error

David Hildenbrand (Arm) david at kernel.org
Tue Apr 14 04:35:02 AEST 2026


On 4/5/26 14:51, Muchun Song wrote:
> In section_activate(), if populate_section_memmap() fails, the error
> handling path calls section_deactivate() to roll back the state. This
> approach introduces an accounting imbalance.
> 
> Since the commit c3576889d87b ("mm: fix accounting of memmap pages"),
> memmap pages are accounted for only after populate_section_memmap()
> succeeds. However, section_deactivate() unconditionally decrements the
> vmemmap account. Consequently, a failure in populate_section_memmap()
> leads to a negative offset (underflow) in the system's vmemmap tracking.
> 
> We can fix this by ensuring that the vmemmap accounting is incremented
> immediately before checking for the success of populate_section_memmap().
> If populate_section_memmap() fails, the subsequent call to
> section_deactivate() will decrement the accounting, perfectly offsetting
> the increment and maintaining balance.
> 
> Fixes: c3576889d87b ("mm: fix accounting of memmap pages")
> Signed-off-by: Muchun Song <songmuchun at bytedance.com>
> ---

Can you send the revised fix separately, please?

AI review flagged that recently on one of my series that touched the
code, thanks for taking it off my todo list :)

-- 
Cheers,

David


More information about the Linuxppc-dev mailing list