From: Gregory Price <gourry@gourry.net>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, akpm@linux-foundation.org, ljs@kernel.org,
liam@infradead.org, vbabka@kernel.org, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, brendan.jackman@linux.dev,
hannes@cmpxchg.org, ziy@nvidia.com,
Balbir Singh <balbirs@nvidia.com>
Subject: Re: [PATCH v2 1/2] mm: refactor find_next_best_node to find_next_best_node_in
Date: Fri, 18 Sep 2026 17:49:37 -0400 [thread overview]
Message-ID: <aq2wXTblglrP6F3o@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <a817fe59-8549-4e5d-9ac8-ab5cc9e214f7@kernel.org>
On Fri, Sep 18, 2026 at 10:42:12PM +0200, David Hildenbrand (Arm) wrote:
> > diff --git a/mm/internal.h b/mm/internal.h
> > index da14c56fb24e..1519dd21a900 100644
> > --- a/mm/internal.h
> > +++ b/mm/internal.h
> > @@ -1133,7 +1133,8 @@ extern int node_reclaim_mode;
> >
> > extern unsigned long node_reclaim(struct pglist_data *pgdat,
> > gfp_t gfp_mask, unsigned int order);
> > -extern int find_next_best_node(int node, nodemask_t *used_node_mask);
> > +int find_next_best_node_in(int node, nodemask_t *used_node_mask,
> > + const nodemask_t *candidates);
>
> Just curious, for your use case, wouldn't it be enough to pass N_MEMORY?
>
> Or do we expect to pass other actual node masks that are not derived from
> node_states?
>
That is the base case today - and in fact that's what's hard-coded
in the current logic.
For the private node series we will pass:
ZONELIST_FALLBACK: N_MEMORY_GENERAL /* general purpose nodes */
ZONELIST_PRIVATE: N_MEMORY /* All nodes, including private */
ZONELIST_KTEST: (N_MEMORY_GENERAL ^ N_MEMORY) /* private only */
the ZONELIST_KTEST is something i'm still working with - but it gives us
fully isolated pgdat structures that allow a KTEST to treat the node
mutations as determinstic and otherwise unreachable by the kernel
(because the kernel outside ktest can't select ZOENLIST_KTEST).
ANYWAY...
I don't expect us to build hundreds of these zonelists - they are
expensive to construct (space-wise), but that's largely because we
haven't needed to optimize it.
But you could imagine having a custom zonelist built on a subset
of N_MEMORY so that you could do like...
for_each_reclaimable_zone(z) {
/* Reclaim */
}
and hide all this nasty zone business from other components of mm/ that
really don't need all that complexity (at most they want the LRUs).
~Gregory
next prev parent reply other threads:[~2026-09-18 21:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 3:04 [PATCH v2 0/2] mm: refactor zonelist constructors and iterators Gregory Price
2026-09-12 3:04 ` [PATCH v2 1/2] mm: refactor find_next_best_node to find_next_best_node_in Gregory Price
2026-09-14 15:00 ` Zi Yan
2026-09-18 20:42 ` David Hildenbrand (Arm)
2026-09-18 21:49 ` Gregory Price [this message]
2026-09-12 3:04 ` [PATCH v2 2/2] mm/page_alloc: refactor build_node_zonelist() out of build_zonelists() Gregory Price
2026-09-14 14:56 ` Vlastimil Babka (SUSE)
2026-09-14 15:04 ` Gregory Price
2026-09-15 16:27 ` [PATCH v2 0/2] mm: refactor zonelist constructors and iterators Zenghui Yu
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=aq2wXTblglrP6F3o@gourry-fedora-PF4VCD3F \
--to=gourry@gourry.net \
--cc=akpm@linux-foundation.org \
--cc=balbirs@nvidia.com \
--cc=brendan.jackman@linux.dev \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--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
all inboxes | Powered by JetHome®