Re: [PATCH 1/2] mm: refactor find_next_best_node to find_next_best_node_in

From: Gregory Price

Date: Thu Sep 03 2026 - 14:26:50 EST


On Thu, Sep 03, 2026 at 05:15:23PM +0200, Vlastimil Babka (SUSE) wrote:
> On 9/2/26 23:58, Gregory Price wrote:
> > find_next_best_node() picks the next-closest node for a fallback list
> > from the full N_MEMORY set. Refactor it into find_next_best_node_in(),
> > which takes an explicit candidates nodemask.
> >
> > This enables building fallback lists with non-N_MEMORY candidates.
> >
> > No functional change: every caller still selects from N_MEMORY.
> >
> > Signed-off-by: Gregory Price <gourry@xxxxxxxxxx>
>
> Reviewed-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
>
> Nit:
>
> > ---
> > mm/internal.h | 6 ++++--
> > mm/memory-tiers.c | 7 ++++---
> > mm/page_alloc.c | 13 ++++++++-----
> > 3 files changed, 16 insertions(+), 10 deletions(-)
> >
> > diff --git a/mm/internal.h b/mm/internal.h
> > index e16f1250b25c8..18d041ff5c52c 100644
> > --- a/mm/internal.h
> > +++ b/mm/internal.h
> > @@ -1130,7 +1130,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);
> > +extern int find_next_best_node_in(int node, nodemask_t *used_node_mask,
> > + const nodemask_t *candidates);
>
> Drop the extern while touching a line.
>

ack.