Re: [PATCH v2] mm/demotion: print demotion targets

From: Andrew Morton
Date: Tue Feb 06 2024 - 15:23:55 EST


On Tue, 6 Feb 2024 10:01:51 +0800 Li Zhijian <lizhijian@xxxxxxxxxxx> wrote:

> Currently, when a demotion occurs, it will prioritize selecting a node
> from the preferred targets as the destination node for the demotion. If
> the preferred node does not meet the requirements, it will try from all
> the lower memory tier nodes until it finds a suitable demotion destination
> node or ultimately fails.
>
> However, the demotion target information isn't exposed to the users,
> especially the preferred target information, which relies on more factors.
> This makes users hard to understand the exact demotion behavior.
>
> Rather than having a new sys interface to expose this information,
> printing directly to kernel messages, just like the current page
> allocation fallback order does.
>
> ...
>
> --- a/mm/memory-tiers.c
> +++ b/mm/memory-tiers.c
> @@ -359,6 +359,26 @@ static void disable_all_demotion_targets(void)
> synchronize_rcu();
> }
>
> +static void dump_demotion_targets(void)

Unrelated, but... establish_demotion_targets() should be __meminit, so
dump_demotion_targets() could also be __meminit.