]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/page_alloc: adding same penalty is enough to get round-robin order
authorWei Yang <richard.weiyang@gmail.com>
Thu, 14 Apr 2022 06:07:09 +0000 (23:07 -0700)
committerakpm <akpm@linux-foundation.org>
Thu, 14 Apr 2022 06:07:09 +0000 (23:07 -0700)
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.  Since we just increase a constance of 1 to node
penalty, it is not necessary to multiply MAX_NODE_LOAD for preference.

Link: https://lkml.kernel.org/r/20220123013537.20491-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Oscar Salvador <osalvador@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Krupa Ramakrishnan <krupa.ramakrishnan@amd.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c

index 1b92795ae5e28bd6d1839ce18d7753fa6b9044e7..73a86a659ce58c3e63fe89197fa0a163cf79655b 100644 (file)
@@ -6286,13 +6286,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));
@@ -6304,11 +6303,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);