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@ghiti.fr>
---
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);
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
On 3/11/26 4:32 PM, 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@ghiti.fr>
This looks LGTM
Reviewed by: Donet Tom <donettom@linux.ibm.com>
> ---
> 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);
> 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;
>
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@ghiti.fr>
> ---
> 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
On 3/12/26 06:28, Byungchul Park wrote: > 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@ghiti.fr> >> --- >> 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()? +1 Maybe throw in the mt_ prefix and call it mt_get_node_demotion_targets() -- Cheers, David
Hi David, Byungchul, On 3/12/26 13:58, David Hildenbrand (Arm) wrote: > On 3/12/26 06:28, Byungchul Park wrote: >> 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@ghiti.fr> >>> --- >>> 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()? > +1 > > Maybe throw in the mt_ prefix and call it > > mt_get_node_demotion_targets() > I'll do, thanks Alex
On Wed, 11 Mar 2026 12:02:41 +0100 Alexandre Ghiti <alex@ghiti.fr> 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. Agreed, node_get_allowed_targets is pretty vague ; -) I do think that node_get_allowed_demotion_targets could be considered a bit too long, but I don't think it's called in too many places where there would be more than just this function call in the line so LGTM! Please feel free to add my review tag, have a great day Alexandre! Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com> > Signed-off-by: Alexandre Ghiti <alex@ghiti.fr> > --- > include/linux/memory-tiers.h | 6 +++--- > mm/memory-tiers.c | 4 ++-- > mm/vmscan.c | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-)
© 2016 - 2026 Red Hat, Inc.