Skip to contentSkip to conversation

sched: Don't try allocating memory from offline nodes

PATCH In review Luck, Tony 3 participants 4 messages May 29, 2012 – May 30, 2012 Scheduler

lore
Share & tools
lore

Luck, Tony

author
#0 lore raw

PATCH 1/1 sched: Don't try allocating memory from offline nodes

From: Peter Zijlstra <[email protected]>

Allocators don't appreciate it when you try and allocate memory from offline nodes.

---

This patch has been sitting around since Friday.

 kernel/sched/core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/sched/core.c +1 -1
Index: linux-2.6/kernel/sched/core.c
===================================================================
@@ -6449,7 +6449,7 @@ static void sched_init_numa(void)
 			return;
 
 		for (j = 0; j < nr_node_ids; j++) {
-			struct cpumask *mask = kzalloc_node(cpumask_size(), GFP_KERNEL, j);
+			struct cpumask *mask = kzalloc(cpumask_size(), GFP_KERNEL);
 			if (!mask)
 				return;
 
#1 lore raw

kernel/sched/core.c static void sched_init_numa(void) · line 6455

Quoted 13 lines · Tony

Index: linux-2.6/kernel/sched/core.c
===================================================================

kernel/sched/core.c +1 -1
@@ -6449,7 +6449,7 @@ static void sched_init_numa(void)
 			return;
 
 		for (j = 0; j < nr_node_ids; j++) {
-			struct cpumask *mask = kzalloc_node(cpumask_size(), GFP_KERNEL, j);
+			struct cpumask *mask = kzalloc(cpumask_size(), GFP_KERNEL);
 			if (!mask)
 				return;
 

It's definitely better if we can allocate on the node, though, so perhaps do the same thing that I did in
http://marc.info/?l=linux-kernel&m=133778739503111 by doing kzalloc_node(..., node_online(j) ? j : NUMA_NO_NODE)?

#2 lore raw
Quoted 9 lines · David Rientjes
Quoted 7 lines · Tony

Index: linux-2.6/kernel/sched/core.c
===================================================================

kernel/sched/core.c +0 -0
@@ -6449,7 +6449,7 @@ static void sched_init_numa(void)
 			return;
 
Quoted 11 lines

kernel/sched/core.c static void sched_init_numa(void) · line 6455

Quoted 6 lines
kernel/sched/core.c +1 -1
 		for (j = 0; j < nr_node_ids; j++) {
-			struct cpumask *mask = kzalloc_node(cpumask_size(), GFP_KERNEL, j);
+			struct cpumask *mask = kzalloc(cpumask_size(), GFP_KERNEL);
 			if (!mask)
 				return;
 

It's definitely better if we can allocate on the node, though, so perhaps do the same thing that I did in
http://marc.info/?l=linux-kernel&m=133778739503111 by doing kzalloc_node(..., node_online(j) ? j : NUMA_NO_NODE)?

This data isn't used overly much, only when rebuilding the sched domains, so its not performance critical. I only used per-node allocations because it seemed the right thing to do. If it doesn't work, I wouldn't bother with making it more complex.

#3 lore raw
Quoted 22 lines · Peter Zijlstra
Quoted 9 lines · David Rientjes
Quoted 7 lines · Tony

Index: linux-2.6/kernel/sched/core.c
===================================================================

kernel/sched/core.c +0 -0
@@ -6449,7 +6449,7 @@ static void sched_init_numa(void)
 			return;
 
Quoted 11 lines

kernel/sched/core.c static void sched_init_numa(void) · line 6455

Quoted 6 lines
kernel/sched/core.c +1 -1
 		for (j = 0; j < nr_node_ids; j++) {
-			struct cpumask *mask = kzalloc_node(cpumask_size(), GFP_KERNEL, j);
+			struct cpumask *mask = kzalloc(cpumask_size(), GFP_KERNEL);
 			if (!mask)
 				return;
 

It's definitely better if we can allocate on the node, though, so perhaps do the same thing that I did in
http://marc.info/?l=linux-kernel&m=133778739503111 by doing kzalloc_node(..., node_online(j) ? j : NUMA_NO_NODE)?

Quoted 5 lines

This data isn't used overly much, only when rebuilding the sched domains, so its not performance critical. I only used per-node allocations because it seemed the right thing to do. If it doesn't work, I wouldn't bother with making it more complex.

Ok, if you don't think these cpumasks need locality for performance, then