Re: [PATCH 08/12] mm/sparse: move __highest_used_section_nr handling

From: David Hildenbrand (Arm)

Date: Thu Sep 10 2026 - 05:35:58 EST


On 9/10/26 10:33, Oscar Salvador (SUSE) wrote:
> On Wed, Sep 09, 2026 at 03:33:01PM +0200, David Hildenbrand (Arm) wrote:
>> Let's move it to sparse_init_one_section(). However, to keep early
>> boot processing working, we also have to initialize it in
>> sparse_sections_init().
>>
>> Should we use READ_ONCE/WRITE_ONCE with __highest_used_section_nr?
>> Probably, something for another day.
>
> What is the worry there?
>
> sparse_init_one_section() calls should run sequentally due to the memhotplug
> lock, so there should not be parallel updates there?

If you have something consuming __highest_used_section_nr while concurrently
updating it, you might get torn reads/writes that mess up the value on the
reader side.

For example, mm/compaction.c consuming __highest_used_section_nr.

I don't think this is critical, so I decided to spell it out instead of fixing
it right away.

--
Cheers,

David