From: Hao Li <hao.li@linux.dev>
To: Joshua Hahn <joshua.hahnjy@gmail.com>,
"Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: david@kernel.org, osalvador@suse.de, akpm@linux-foundation.org,
vbabka@suse.cz, harry.yoo@oracle.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org
Subject: Re: [PATCH] mm/memory_hotplug: maintain N_NORMAL_MEMORY during hotplug
Date: Sat, 28 Mar 2026 12:03:11 +0800 [thread overview]
Message-ID: <onaszvpegcqt2y3domgplkne5wrpk7iibgj3mybx4wvckqwe5f@qrnlhiksef4b> (raw)
In-Reply-To: <20260327163554.42487-1-joshua.hahnjy@gmail.com>
On Fri, Mar 27, 2026 at 09:35:54AM -0700, Joshua Hahn wrote:
> On Fri, 27 Mar 2026 15:44:18 +0100 "Vlastimil Babka (SUSE)" <vbabka@kernel.org> wrote:
>
> > On 3/27/26 15:38, Joshua Hahn wrote:
> > > On Fri, 27 Mar 2026 20:42:47 +0800 Hao Li <hao.li@linux.dev> wrote:
> > >
> > > Hello Hao,
> > >
> > > I hope you are doing well, thank you for the patch!
> > >
> > >> N_NORMAL_MEMORY is initialized from zone population at boot, but memory
> > >> hotplug currently only updates N_MEMORY. As a result, a node that gains
> > >> normal memory via hotplug can remain invisible to users iterating over
> > >> N_NORMAL_MEMORY, while a node that loses its last normal memory can stay
> > >> incorrectly marked as such.
> > >
> > > The second part feels more important than the second part, doing a quick
> > > glance through the code I can see a few N_NORMAL_MEMORY iterators that
> >
> > Note in practice it's unlikely that a node would hotplug normal memory,
> > start using it, and then manage to successfully hotremove it, due to
> > unmovable allocations. Most likely only ZONE_MOVABLE memory can get hotremoved.
>
> Hello Vlastimil! I hope you are doing well.
>
> Yup, makes sense : -)
Yes, indeed.
>
> > > are in some hot paths like shrink_memcg. Iterating over nodes that don't
> > > contain any NORMAL memory seems like an inefficiency rather than a bug
> > > though.
> >
> > Ignoring nodes that have normal memory, just because it was hotplugged, will
> > result also just in some form of inefficiency, or can the consequences be worse?
>
> Aaaahh yeah, seems like ignoring the hotplugged normal memory would be a bigger
> problem. struct zswap_entries allocated from slab allocator on hotplugged
> nodes would just get ignored by shrink_memcg, seems like a much bigger
> issue than iterating through extra nodes :P thanks for calling this out.
Yes, make sense to me. It could be more serious than just inefficiency. The
shrinkers might even fail to visit reclaimable objects on that node.
>
> > >> Restore N_NORMAL_MEMORY maintenance directly in online_pages() and
> > >> offline_pages(). Set the bit when a node that currently lacks normal
> > >> memory onlines pages into a zone <= ZONE_NORMAL, and clear it when
> > >> offlining removes the last present pages from zones <= ZONE_NORMAL.
> > >>
> > >> This restores the intended semantics without bringing back the old
> > >> status_change_nid_normal notifier plumbing which was removed in
> > >> 8d2882a8edb8.
> >
> > But commit 8d2882a8edb8 didn't introduce the current state, or did it?
>
> I don't mean to speak on Hao's behalf, but as far as I can tell I think this
> would have been the commit to introduce the state, since
> node_states_check_changes_online would set status_change_nid_normal to nid,
> then nodes_states_set_node would come around and set it to N_NORMAL_MEMORY.
> Maybe I'm missing something? :0
Thanks for this analysis. I was thinking the same. N_NORMAL_MEMORY is no longer
updated after this commit.
>
> Thanks for the reply, Vlastimil. I hope you have a great day : -)
> Joshua
--
Thanks,
Hao
next prev parent reply other threads:[~2026-03-28 4:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-27 12:42 Hao Li
2026-03-27 14:38 ` Joshua Hahn
2026-03-27 14:44 ` Vlastimil Babka (SUSE)
2026-03-27 15:22 ` David Hildenbrand (Arm)
2026-03-28 4:09 ` Hao Li
2026-03-27 16:35 ` Joshua Hahn
2026-03-28 4:03 ` Hao Li [this message]
2026-03-30 11:43 ` Vlastimil Babka (SUSE)
2026-03-27 15:28 ` David Hildenbrand (Arm)
2026-03-28 4:12 ` Hao Li
2026-03-28 3:47 ` Hao Li
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=onaszvpegcqt2y3domgplkne5wrpk7iibgj3mybx4wvckqwe5f@qrnlhiksef4b \
--to=hao.li@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=harry.yoo@oracle.com \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
--cc=vbabka@kernel.org \
--cc=vbabka@suse.cz \
/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