mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gregory Price <gourry@gourry.net>
To: Zi Yan <ziy@nvidia.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com,  akpm@linux-foundation.org,
	david@kernel.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
Subject: Re: [PATCH v2 2/2] mm/page_alloc: refactor build_node_zonelist() out of build_zonelists()
Date: Mon, 21 Sep 2026 12:38:57 -0400	[thread overview]
Message-ID: <arFaiV9iVgxIsZ1g@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <C7A2977A-CDD8-4EEF-9448-A130411878B6@nvidia.com>

On Mon, Sep 21, 2026 at 12:18:12PM -0400, Zi Yan wrote:
> On 20 Sep 2026, at 23:29, Gregory Price wrote:
> 
> OK, ZONELIST_PRIVATE and ZONELIST_KTEST are not upstream yet, right?
> In theory, the new zlidx can be added when you add new ZONELIST_ types.
> 
> I am OK with adding it now, but you could mention this change in
> the commit message to avoid confusion. Something like,
> for bulid_node_zonelist(), use ZONELIST_FALLBACK explicitly.
>
...
> > And add a BUILD_ON_BUG/ASSERT that forces any CONFIG_NUMA to have
> > balanced zonelist additions.
> 
> Got it. Thank you for the explanation. Are all combinations of
> {ZONELIST_FALLBACK, ZONELIST_PRIVATE, ZONELIST_KTEST} x
> {N_MEMORY_GENERAL, N_MEMORY, /* private only */} allowed?

Slight inaccuracy on the way zonelists are actually built.

Every node has a list in every zonelist.  The contents of each node's
list in that zonelist are limited to the candidate nodemask.

So consider the following nodes:  N0, N1, P2   (N=normal, P=private)

With the following candidate mappings:
   FALLBACK = N_MEMORY_GENERAL  (_COMMON)  (all normal nodes)
   PRIVATE  = N_MEMORY                     (all nodes)
   KTEST    = N_MEMORY & !N_MEMORY_GENERAL (only private nodes)

FALLBACK
  0  :  [0,1]
  1  :  [1,0]
  2  :  [0,1]  <- private node's fallback list is normal nodes

NOFALLBACK
  0  :  [0]
  1  :  [1]
  2  :  [2]

PRIVATE          Accessible via ALLOC_PRIVATE_ZONELIST
  0  :  [0,1,2]
  1  :  [1,0,2]
  2  :  [2,0,1]

PRIVATE_NOFALLBACK
  0  :  [0]
  1  :  [1]
  2  :  [2]

KTEST             Not accessible via any flag, completely isolated
  0  :  [2]
  1  :  [2]
  2  :  [2]

KTEST_NOFALLBACK  Not accessible via any flag, completely isolated
  0  :  []
  1  :  []
  2  :  [2]

I haven't posted the ktest series yet, but it's how i've made the page
allocator ktest-able.  Ktest is empowered to set the fallback list
directly rather than requiring a flag - not something any in-tree caller
can do - which lets it limit allocations to a private node and makes
mutations on the pgdat for that node deterministic from test-to-test.

Works on UML too, so testing is very fast. :]

Apologies for the added complexity in the explanation, but I figure it's
worth spelling out.

> Any enforcement if not? This is more related your “private node” series,
> instead of this patchset.
>

These zonelists aren't something we're going to allocate dynamically,
the enforcement is encoded in the function (build ZONELIST_X over
candidates N_MEMORY_Y).

> >
> > But I don't think it's strictly necessary for any of this, and we're
> > just shuffling code from one place to another.  Probably I can just add
> > that improvement when we add the next zonelist.  In the meantime - this
> > makes it easier to add new zonelists as-is (and just makes the code more
> > readable).
> 
> Sure, no rush.
> 
> Feel free to add
> 
> Reviewed-by: Zi Yan <ziy@nvidia.com>
> 
> after you add some text on the added zlidx in the commit message.
> 

ack. hopefully the explanation above helps.

I will work that into the commit message in a reduced capacity.

~Gregory

  reply	other threads:[~2026-09-21 16:39 UTC|newest]

Thread overview: 20+ 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
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-21  2:49   ` Zi Yan
2026-09-21  2:53     ` Zi Yan
2026-09-21  3:33       ` Gregory Price
2026-09-21 16:20         ` Zi Yan
2026-09-21  3:29     ` Gregory Price
2026-09-21 16:18       ` Zi Yan
2026-09-21 16:38         ` Gregory Price [this message]
2026-09-21 17:04           ` Gregory Price
2026-09-21 17:18           ` Zi Yan
2026-09-21 23:58           ` Zi Yan
2026-09-22  1:02             ` 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=arFaiV9iVgxIsZ1g@gourry-fedora-PF4VCD3F \
    --to=gourry@gourry.net \
    --cc=akpm@linux-foundation.org \
    --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®