LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Huang Ying <ying.huang@intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Zi Yan <ziy@nvidia.com>,
	zhongjiang-ali@linux.alibaba.com,
	Xunlei Pang <xlpang@linux.alibaba.com>,
	Linux MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: migrate: Add more comments for selecting target node randomly
Date: Wed, 24 Nov 2021 11:25:36 -0800	[thread overview]
Message-ID: <CAHbLzkr5sTz7w=SXjAwDBu77Fog2LuiXV7STY4nZ4j2o+LpAxw@mail.gmail.com> (raw)
In-Reply-To: <c31d36bd097c6e9e69fc0f409c43b78e53e64fc2.1637766801.git.baolin.wang@linux.alibaba.com>

On Wed, Nov 24, 2021 at 7:17 AM Baolin Wang
<baolin.wang@linux.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@linux.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@gmail.com>

>                  */
>                 index = get_random_int() % target_nr;
>                 break;
> --
> 2.27.0
>

      reply	other threads:[~2021-11-24 19:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 15:16 Baolin Wang
2021-11-24 19:25 ` Yang Shi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHbLzkr5sTz7w=SXjAwDBu77Fog2LuiXV7STY4nZ4j2o+LpAxw@mail.gmail.com' \
    --to=shy828301@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xlpang@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    --cc=zhongjiang-ali@linux.alibaba.com \
    --cc=ziy@nvidia.com \
    --subject='Re: [PATCH] mm: migrate: Add more comments for selecting target node randomly' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).