From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Zhijian Han <hanzhijian1991@gmail.com>,
Oscar Salvador <osalvador@suse.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/memory_hotplug: cache zone stats for "auto-movable" online policy
Date: Tue, 22 Sep 2026 12:17:29 +0200 [thread overview]
Message-ID: <f12c2f4e-a437-454d-809e-902c5fed4403@kernel.org> (raw)
In-Reply-To: <20260922082207.3224897-1-hanzhijian1991@gmail.com>
On 9/22/26 10:22, Zhijian Han wrote:
> When onlining memory using the "auto-movable" online policy with
> nid == NUMA_NO_NODE, auto_movable_can_online_movable() walks all
> populated zones across all nodes on each invocation to collect the
> MOVABLE vs. KERNEL_EARLY stats. This walk happens twice for every
> memory block onlining decision (global check and, with NUMA awareness
> enabled, per-node check) and is repeated for every single memory block
> that gets onlined, although the underlying zone counters rarely change.
>
> Cache the stats for nid == NUMA_NO_NODE and only recalculate them when
> a zone counter actually changes. All modifications of the relevant
> zone counters (present_pages, present_early_pages) funnel through
> adjust_present_page_count(), which is only called while holding the
> mem_hotplug_lock in write mode and the device_lock() of the memory
> block device. Invalidate the cache there, such that the next
> auto-movable onlining decision recalculates the stats from scratch.
>
> CMA adjustments (zone->cma_pages) only happen during boot (via
> init_cma_reserved_pageblock()/init_cma_pageblock(), both __init) and
> cannot race with memory onlining. Boot-time zone initialization
> happens before any memory block can be onlined.
>
> The per-node path (nid != NUMA_NO_NODE) is left uncached; it only
> walks a single node's zones.
>
> Resolve a TODO that was left when the "auto-movable" online policy was
> introduced.
I have to ask
1) Why is this TODO a concern for you. Are you a frequent memory hotplug user or
somehow working on memory hotplug.
2) Did you use an LLM to come up with this idea or this patch.
3) Why is there no discussion / performance measurements whether the TODO should
be removed instead.
I'll point you at:
https://lore.kernel.org/linux-mm/20251206212507.135503-1-swarajgaikwad1925@gmail.com/
--
Cheers,
David
prev parent reply other threads:[~2026-09-22 10:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 8:22 [PATCH] mm/memory_hotplug: cache zone stats for "auto-movable" online policy Zhijian Han
2026-09-22 10:17 ` David Hildenbrand (Arm) [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=f12c2f4e-a437-454d-809e-902c5fed4403@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hanzhijian1991@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
/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