Re: [PATCH 02/22] mm: publish and clear node memory states via helpers
From: Gregory Price (Meta)
Date: Wed Nov 18 2026 - 10:22:40 EST
On 2026-11-18 15:53 +0800, Richard Cheng wrote:
> > /*
> > - * Check whether we are adding normal memory to the node for the first
> > - * time.
> > + * Publish this node's memory states, including any newly-normal zone.
> > + * Hotplug never adds highmem.
> > */
> > - if (!node_state(nid, N_NORMAL_MEMORY) && zone_idx(zone) <= ZONE_NORMAL)
> > - node_set_state(nid, N_NORMAL_MEMORY);
> > + node_set_memory_state(nid, false, zone_idx(zone) <= ZONE_NORMAL);
> >
>
> Um, so I am not sure how much cache pressure this will add, I assume it's small ?
>
> Just want to point out that the old code only wrote these bits for a node's first
> memory. THis now does up to 3 set_bit() calls on node_states[] for every onlined block.
> The result is the same, but node_states[] is __read_mostly. A test-before-set in the helper
> would keep the old behavior, or if you would like to keep it, please address in commit message.
>
Hotplug isn't on a particular hot path, but I can test N_MEMORY before
setting any new state and just early-out. That would keep the behavior.
--
~Gregory