[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHbLzkr5sTz7w=SXjAwDBu77Fog2LuiXV7STY4nZ4j2o+LpAxw@mail.gmail.com>
Date: Wed, 24 Nov 2021 11:25:36 -0800
From: Yang Shi <shy828301@...il.com>
To: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Huang Ying <ying.huang@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Zi Yan <ziy@...dia.com>, zhongjiang-ali@...ux.alibaba.com,
Xunlei Pang <xlpang@...ux.alibaba.com>,
Linux MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: migrate: Add more comments for selecting target node randomly
On Wed, Nov 24, 2021 at 7:17 AM Baolin Wang
<baolin.wang@...ux.alibaba.com> wrote:
>
> As Yang Shi suggested [1], it will be helpful to explain why we should
> select target node randomly now if there are multiple target nodes.
>
> [1] https://lore.kernel.org/all/CAHbLzkqSqCL+g7dfzeOw8fPyeEC0BBv13Ny1UVGHDkadnQdR=g@mail.gmail.com/
> Signed-off-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
> ---
> mm/migrate.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 8d39720de4eb..d9af89248196 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1209,6 +1209,14 @@ int next_demotion_node(int node)
> /*
> * If there are multiple target nodes, just select one
> * target node randomly.
> + *
> + * In addition, we can also use round-robin to select
> + * target node, but we should introduce another variable
> + * for node_demotion[] to record last selected target node,
> + * that may cause cache ping-pong due to the changing of
> + * last target node. Or introducing per-cpu data to avoid
> + * caching issue, which seems more complicated. So selecting
> + * target node randomly seems better until now.
Thank you.
Reviewed-by: Yang Shi <shy828301@...il.com>
> */
> index = get_random_int() % target_nr;
> break;
> --
> 2.27.0
>
Powered by blists - more mailing lists