Re: [PATCH] mm/sparse: Fix race on mem_section->usage in pfn walkers

From: David Hildenbrand (Arm)

Date: Wed Apr 15 2026 - 04:07:39 EST


On 4/15/26 04:23, Muchun Song wrote:
> When memory is hot-removed, section_deactivate() can tear down
> mem_section->usage while concurrent pfn walkers still inspect the
> subsection map via pfn_section_valid() or pfn_section_first_valid().

I'll note that it's all racy either way: someone checking pfn_valid() /
pfn_to_online_page() can race with concurrent unplug.

We've known that for years; it's hard to fix; it never ever triggers :)

So is this really worth it, when we should in fact, work on protecting
the users of pfn_valid() / pfn_to_online_page() with rcu or similar?

--
Cheers,

David