linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: migrate: Add more comments for selecting target node randomly
@ 2021-11-24 15:16 Baolin Wang
  2021-11-24 19:25 ` Yang Shi
  0 siblings, 1 reply; 2+ messages in thread
From: Baolin Wang @ 2021-11-24 15:16 UTC (permalink / raw)
  To: akpm, ying.huang, dave.hansen
  Cc: ziy, shy828301, baolin.wang, zhongjiang-ali, xlpang, linux-mm,
	linux-kernel

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.
 		 */
 		index = get_random_int() % target_nr;
 		break;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: migrate: Add more comments for selecting target node randomly
  2021-11-24 15:16 [PATCH] mm: migrate: Add more comments for selecting target node randomly Baolin Wang
@ 2021-11-24 19:25 ` Yang Shi
  0 siblings, 0 replies; 2+ messages in thread
From: Yang Shi @ 2021-11-24 19:25 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Andrew Morton, Huang Ying, Dave Hansen, Zi Yan, zhongjiang-ali,
	Xunlei Pang, Linux MM, Linux Kernel Mailing List

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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-24 19:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 15:16 [PATCH] mm: migrate: Add more comments for selecting target node randomly Baolin Wang
2021-11-24 19:25 ` Yang Shi

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).