Skip to content

mm: refactor zonelist constructors and iterators

Gregory Price linux-mm lkml 3 versions – Applied

Status from this message: [merged mm-stable] mm-page_alloc-refactor-build_node_zonelist-out-of-build_zonelists.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 0 repliesApplied 2/2
  2. v22 patches 17 repliesSuperseded
  3. v12 patches 5 repliesSuperseded

Changes in v3 from the cover letter

- mention the new zlidx argument in patch 2's commit message (Zi Yan)

Patches in v3 All 2 applied

#Subject and filesSizeRepliesApplied
1/2mm: refactor find_next_best_node to find_next_best_node_inmm/internal.h mm/memory-tiers.c mm/page_alloc.c+16 -100 repliesApplied
2/2mm/page_alloc: refactor build_node_zonelist() out of build_zonelists()mm/page_alloc.c+23 -400 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchVlastimil Babka (SUSE)Balbir SinghZi YanZenghui Yu (Huawei)
1/2R-b A-b R-b R-b
2/2R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/2] mm: refactor zonelist constructors and iterators

find_next_best_node() picks the next-closest node when building a fallback list, and hardcodes N_MEMORY as the set it picks from.

Refactor it into find_next_best_node_in(), which takes the candidate set explicitly.

This makes the existing behaviour explicit at both mm/memory-tiers.c call sites - they select demotion targets in fallback order from N_MEMORY - and lets callers narrow that set.

Then extract the per-node construction loop out of build_zonelists() into build_node_zonelist(), parameterised on the candidate nodemask and destination zonelist index.

Together these allow a zonelist to be built over a candidate set other than N_MEMORY, into a zonelist other than FALLBACK, and iterated in fallback order over a caller-defined subset.

These are prerequisites for generating a private node zonelist (nodes unreachable by default), but are otherwise general improvements to the existing interfaces so I'm proposing them separately.

No functional change intended - purely refactor commits.

Verified on x86_64:

- find_next_best_node_in() compiles to the same 319 bytes as

    find_next_best_node().

- Both mm/memory-tiers.c callers grow a single instruction - the added argument.
- Boot-time fallback orders are identical on a 4-node guest with an asymmetric distance matrix.

v3:
- mention the new zlidx argument in patch 2's commit message (Zi Yan)

Gregory Price (2):
mm: refactor find_next_best_node to find_next_best_node_in mm/page_alloc: refactor build_node_zonelist() out of build_zonelists()

 mm/internal.h     |  6 ++--
 mm/memory-tiers.c |  7 +++--
 mm/page_alloc.c   | 74 +++++++++++++++++++----------------------------
 3 files changed, 38 insertions(+), 49 deletions(-)
Signature · 1 line
2.55.0