Re: [PATCH 2/4] mm: Rename node_get_allowed_targets() to make it more explicit

From: Byungchul Park

Date: Thu Mar 12 2026 - 01:28:54 EST


On Wed, Mar 11, 2026 at 12:02:41PM +0100, Alexandre Ghiti wrote:
> This function actually returns the tier nodes that are targeted during a
> demotion, so rename it to be more explicit.
>
> No functional change intended.
>
> Signed-off-by: Alexandre Ghiti <alex@xxxxxxxx>
> ---
> include/linux/memory-tiers.h | 6 +++---
> mm/memory-tiers.c | 4 ++--
> mm/vmscan.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h
> index 0bf0d002939e..ec39dc3c39e6 100644
> --- a/include/linux/memory-tiers.h
> +++ b/include/linux/memory-tiers.h
> @@ -54,7 +54,7 @@ struct memory_dev_type *mt_find_alloc_memory_type(int adist,
> void mt_put_memory_types(struct list_head *memory_types);
> #ifdef CONFIG_MIGRATION
> int next_demotion_node(int node, const nodemask_t *allowed_mask);
> -void node_get_allowed_targets(pg_data_t *pgdat, nodemask_t *targets);
> +void node_get_allowed_demotion_targets(pg_data_t *pgdat, nodemask_t *targets);

Look better than before to me.

What about just node_get_demotion_targets()?

Byungchul

> bool node_is_toptier(int node);
> unsigned int mt_demote_folios(struct list_head *demote_folios,
> struct pglist_data *pgdat,
> @@ -65,7 +65,7 @@ static inline int next_demotion_node(int node, const nodemask_t *allowed_mask)
> return NUMA_NO_NODE;
> }
>
> -static inline void node_get_allowed_targets(pg_data_t *pgdat, nodemask_t *targets)
> +static inline void node_get_allowed_demotion_targets(pg_data_t *pgdat, nodemask_t *targets)
> {
> *targets = NODE_MASK_NONE;
> }
> @@ -117,7 +117,7 @@ static inline int next_demotion_node(int node, const nodemask_t *allowed_mask)
> return NUMA_NO_NODE;
> }
>
> -static inline void node_get_allowed_targets(pg_data_t *pgdat, nodemask_t *targets)
> +static inline void node_get_allowed_demotion_targets(pg_data_t *pgdat, nodemask_t *targets)
> {
> *targets = NODE_MASK_NONE;
> }
> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
> index afdf21738a54..19ecc9b6bbda 100644
> --- a/mm/memory-tiers.c
> +++ b/mm/memory-tiers.c
> @@ -300,7 +300,7 @@ bool node_is_toptier(int node)
> return toptier;
> }
>
> -void node_get_allowed_targets(pg_data_t *pgdat, nodemask_t *targets)
> +void node_get_allowed_demotion_targets(pg_data_t *pgdat, nodemask_t *targets)
> {
> struct memory_tier *memtier;
>
> @@ -428,7 +428,7 @@ unsigned int mt_demote_folios(struct list_head *demote_folios,
> if (list_empty(demote_folios))
> return 0;
>
> - node_get_allowed_targets(pgdat, &allowed_mask);
> + node_get_allowed_demotion_targets(pgdat, &allowed_mask);
> mem_cgroup_node_filter_allowed(memcg, &allowed_mask);
> if (nodes_empty(allowed_mask))
> return 0;
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 5e0138b94480..11a97ee8f583 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -351,7 +351,7 @@ static bool can_demote(int nid, struct scan_control *sc,
> if (sc && sc->no_demotion)
> return false;
>
> - node_get_allowed_targets(pgdat, &allowed_mask);
> + node_get_allowed_demotion_targets(pgdat, &allowed_mask);
> if (nodes_empty(allowed_mask))
> return false;
>
> --
> 2.53.0