From: Muchun Song <muchun.song@linux.dev>
To: Michal Hocko <mhocko@suse.com>
Cc: Muchun Song <songmuchun@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@kernel.org>,
linux-mm@kvack.org, Suren Baghdasaryan <surenb@google.com>,
Brendan Jackman <jackmanb@google.com>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
zihan zhou <15645113830zzh@gmail.com>,
yaowenchao <yaowenchao@jd.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: Fix zone reserve update serialization
Date: Mon, 11 May 2026 21:11:40 +0800 [thread overview]
Message-ID: <E30FECDF-EC4C-458F-866B-01BE710984C9@linux.dev> (raw)
In-Reply-To: <agHS2xXSgW4YxJF2@tiehlicka>
> On May 11, 2026, at 21:00, Michal Hocko <mhocko@suse.com> wrote:
>
> On Mon 11-05-26 20:53:56, Muchun Song wrote:
>>
>>
>>>> On May 11, 2026, at 20:33, Michal Hocko <mhocko@suse.com> wrote:
>>>
>>> On Mon 11-05-26 20:04:09, Muchun Song wrote:
>>>> Serialize lowmem reserve and watermark updates with the same lock so
>>>> calculate_totalreserve_pages() cannot observe partially updated zone
>>>> reserve state.
>>>
>>> Could you describe the problem you are facing?
>>
>> To be more precise, commit 9726891fe753 moved
>> the call to setup_per_zone_lowmem_reserve into
>> adjust_managed_page_count. Since adjust_managed_page_count
>> can be executed concurrently across multiple CPUs
>> (especially during memory hotplug or parallel initialization),
>> I am concerned that this might lead to inconsistent updates for
>> the following counters:
>>
>> zone->lowmem_reserve
>> pgdat->totalreserve_pages
>> The global totalreserve_pages
>>
>> If these updates are not atomic or properly synchronized,
>> the resulting values could be inaccurate. This inconsistency
>> might cause issues for other kernel subsystems that rely on
>> these reserve counts for memory allocation and reclamation
>> decisions.
>>
>> Just to clarify, I noticed this potential issue while reviewing
>> the source code; it is not a bug I have encountered in a production
>> environment yet.
>
> This is important part that should be part of the changelog. Theoretical
> issue observed when reading the code.
> While it is really trivial to see that there is a race condition. It is
> much less obvious whether the race condition actually matters and worth
> fixing by introducing a new lock. So this needs much more explanation.
> I am not against the patch but the changelog is quite underdocumented.
Got it. I’ll update a version with more precise information in the commit.
Thanks,
Muchun
>
> --
> Michal Hocko
> SUSE Labs
prev parent reply other threads:[~2026-05-11 13:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 12:04 [PATCH] mm/page_alloc: Fix zone reserve update serialization Muchun Song
2026-05-11 12:33 ` Michal Hocko
2026-05-11 12:53 ` Muchun Song
2026-05-11 13:00 ` Michal Hocko
2026-05-11 13:11 ` Muchun Song [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E30FECDF-EC4C-458F-866B-01BE710984C9@linux.dev \
--to=muchun.song@linux.dev \
--cc=15645113830zzh@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=songmuchun@bytedance.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=yaowenchao@jd.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox