Skip to contentSkip to conversation

mm/page_alloc: clear node_load[] in function build_zonelists

PATCH In review Wei Yang 1 participant 2 messages Jan 15, 2022

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 mm/page_alloc: clear node_load[] in function build_zonelists

static variable node_load[] is a helper variable during build zonelist. On each turn for building zonelist, node_load[] is cleared. So this is proper to do this in function build_zonelist.

Another side effect is, #ifdef CONFIG_NUMA could be removed since node_load[] is only defined when CONFIG_NUMA is set.

---
 mm/page_alloc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
mm/page_alloc.c +1 -4
index c5952749ad40..8245f5a24aad 100644
@@ -6255,6 +6255,7 @@ static void build_zonelists(pg_data_t *pgdat)
 	prev_node = local_node;
 
 	memset(node_order, 0, sizeof(node_order));
+	memset(node_load, 0, sizeof(node_load));
 	while ((node = find_next_best_node(local_node, &used_mask)) >= 0) {
 		/*
 		 * We don't want to pressure a particular node.
@@ -6371,10 +6372,6 @@ static void __build_all_zonelists(void *data)
 
 	spin_lock(&lock);
 
-#ifdef CONFIG_NUMA
-	memset(node_load, 0, sizeof(node_load));
-#endif
-
 	/*
 	 * This node is hotadded and no memory is yet present.   So just
 	 * building zonelists is fine - no need to touch other nodes.
Signature · 1 line
2.33.1
author
#1 lore raw
Quoted 4 lines · Wei Yang

static variable node_load[] is a helper variable during build zonelist. On each turn for building zonelist, node_load[] is cleared. So this is proper to do this in function build_zonelist.

Hm... sounds I missed some important part of this operation.

Please forget this one :-(

Quoted 3 lines

Another side effect is, #ifdef CONFIG_NUMA could be removed since node_load[] is only defined when CONFIG_NUMA is set.

Signature · 2 lines
Wei Yang
Help you, Help me