linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Wei Yang <richard.weiyang@gmail.com>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/page_alloc: add same penalty is enough to get round-robin order
Date: Tue, 5 Apr 2022 19:11:12 +0200	[thread overview]
Message-ID: <c56564cd-87f0-25c8-bb78-2bb8d8ad2655@suse.cz> (raw)
In-Reply-To: <20220123013537.20491-1-richard.weiyang@gmail.com>

On 1/23/22 02:35, Wei Yang wrote:
> To make node order in round-robin in the same distance group, we add a
> penalty to the first node we got in each round.
> 
> To get a round-robin order in the same distance group, we don't need to
> decrease the penalty since:
> 
>   * find_next_best_node() always iterates node in the same order
>   * distance matters more then penalty in find_next_best_node()
>   * in nodes with the same distance, the first one would be picked up
> 
> So it is fine to increase same penalty when we get the first node in the
> same distance group.

With that logic I'm not even sure if we need nr_online_nodes as penalty or
it could be just 1. Would you know?

> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
>  mm/page_alloc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index c5952749ad40..f27afd517652 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6245,13 +6245,12 @@ static void build_thisnode_zonelists(pg_data_t *pgdat)
>  static void build_zonelists(pg_data_t *pgdat)
>  {
>  	static int node_order[MAX_NUMNODES];
> -	int node, load, nr_nodes = 0;
> +	int node, nr_nodes = 0;
>  	nodemask_t used_mask = NODE_MASK_NONE;
>  	int local_node, prev_node;
>  
>  	/* NUMA-aware ordering of nodes */
>  	local_node = pgdat->node_id;
> -	load = nr_online_nodes;
>  	prev_node = local_node;
>  
>  	memset(node_order, 0, sizeof(node_order));
> @@ -6263,11 +6262,10 @@ static void build_zonelists(pg_data_t *pgdat)
>  		 */
>  		if (node_distance(local_node, node) !=
>  		    node_distance(local_node, prev_node))
> -			node_load[node] += load;
> +			node_load[node] += nr_online_nodes;
>  
>  		node_order[nr_nodes++] = node;
>  		prev_node = node;
> -		load--;
>  	}
>  
>  	build_zonelists_in_node_order(pgdat, node_order, nr_nodes);



  parent reply	other threads:[~2022-04-05 17:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23  1:35 Wei Yang
2022-01-23  1:35 ` [PATCH 2/2] mm/page_alloc: add penalty to local_node Wei Yang
2022-03-21 21:17 ` [PATCH 1/2] mm/page_alloc: add same penalty is enough to get round-robin order Andrew Morton
2022-03-26 15:48   ` Wei Yang
2022-04-05 17:11 ` Vlastimil Babka [this message]
2022-04-06 23:47   ` Wei Yang
2022-04-07  9:53     ` Vlastimil Babka

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=c56564cd-87f0-25c8-bb78-2bb8d8ad2655@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=richard.weiyang@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox