Skip to contentSkip to conversation

ppc64 scheduler fixes

PATCH In review Anton Blanchard 3 participants 10 messages Jul 25, 2011 – Sep 20, 2011 PowerPC

lore
Share & tools
lore
#0 lore raw

cover ppc64 scheduler fixes

Here are a set of ppc64 scheduler fixes that help with some multi node performance issues.

#1 lore raw

PATCH 1/5 powerpc/numa: Enable SD_WAKE_AFFINE in node definition

When chasing a performance issue on ppc64, I noticed tasks communicating via a pipe would often end up on different nodes.

It turns out SD_WAKE_AFFINE is not set in our node defition. Commit 9fcd18c9e63e (sched: re-tune balancing) enabled SD_WAKE_AFFINE in the node definition for x86 and we need a similar change for ppc64.

I used lmbench lat_ctx and perf bench pipe to verify this fix. Each benchmark was run 10 times and the average taken.

lmbench lat_ctx:

before:  66565 ops/sec
after:  204700 ops/sec

3.1x faster

perf bench pipe:

before: 5.6570 usecs
after:  1.3470 usecs

4.2x faster

---

Cc-ing arch maintainers who might need to look at their SD_NODE_INIT definitions

arch/powerpc/include/asm/topology.h +1 -1
Index: linux-2.6-work/arch/powerpc/include/asm/topology.h
===================================================================
@@ -73,7 +73,7 @@ static inline int pcibus_to_node(struct
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
 				| 0*SD_BALANCE_WAKE			\
-				| 0*SD_WAKE_AFFINE			\
+				| 1*SD_WAKE_AFFINE			\
 				| 0*SD_PREFER_LOCAL			\
 				| 0*SD_SHARE_CPUPOWER			\
 				| 0*SD_POWERSAVINGS_BALANCE		\
#2 lore raw

PATCH 2/5 sched: Allow SD_NODES_PER_DOMAIN to be overridden

In reply to Anton Blanchard

We want to override the default value of SD_NODES_PER_DOMAIN on ppc64, so move it into linux/topology.h.

---

include/linux/topology.h +4 -0
Index: linux-2.6-work/include/linux/topology.h
===================================================================
@@ -201,6 +201,10 @@ int arch_update_cpu_topology(void);
 	.balance_interval	= 64,					\
 }
 
+#ifndef SD_NODES_PER_DOMAIN
+#define SD_NODES_PER_DOMAIN 16
+#endif
+
 #ifdef CONFIG_SCHED_BOOK
 #ifndef SD_BOOK_INIT
 #error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!
kernel/sched.c +0 -2
Index: linux-2.6-work/kernel/sched.c
===================================================================
@@ -6938,8 +6938,6 @@ static int __init isolated_cpu_setup(cha
 
 __setup("isolcpus=", isolated_cpu_setup);
 
-#define SD_NODES_PER_DOMAIN 16
-
 #ifdef CONFIG_NUMA
 
 /**
#3 lore raw

PATCH 3/5 powerpc/numa: Increase SD_NODES_PER_DOMAIN to 32.

In reply to Anton Blanchard

The largest POWER7 boxes have 32 nodes. SD_NODES_PER_DOMAIN groups nodes into chunks of 16 and adds a global balancing domain (SD_ALLNODES) above it.

If we bump SD_NODES_PER_DOMAIN to 32, then we avoid this extra level of balancing on our largest boxes.

---

arch/powerpc/include/asm/topology.h +6 -0
Index: linux-2.6-work/arch/powerpc/include/asm/topology.h
===================================================================
@@ -28,6 +28,12 @@ struct device_node;
  */
 #define RECLAIM_DISTANCE 10
 
+/*
+ * Avoid creating an extra level of balancing (SD_ALLNODES) on the largest
+ * POWER7 boxes which have a maximum of 32 nodes.
+ */
+#define SD_NODES_PER_DOMAIN 32
+
 #include <asm/mmzone.h>
 
 static inline int cpu_to_node(int cpu)
#4 lore raw

PATCH 4/5 powerpc/numa: Disable NEWIDLE balancing at node level

In reply to Anton Blanchard

On big POWER7 boxes we see large amounts of CPU time in system processes like workqueue and watchdog kernel threads.

We currently rebalance the entire machine each time a task goes idle and this is very expensive on large machines. Disable newidle balancing at the node level and rely on the scheduler tick to rebalance across nodes.

---

arch/powerpc/include/asm/topology.h +1 -1
Index: linux-2.6-work/arch/powerpc/include/asm/topology.h
===================================================================
@@ -75,7 +75,7 @@ static inline int pcibus_to_node(struct
 	.forkexec_idx		= 0,					\
 									\
 	.flags			= 1*SD_LOAD_BALANCE			\
-				| 1*SD_BALANCE_NEWIDLE			\
+				| 0*SD_BALANCE_NEWIDLE			\
 				| 1*SD_BALANCE_EXEC			\
 				| 1*SD_BALANCE_FORK			\
 				| 0*SD_BALANCE_WAKE			\
#5 lore raw

PATCH 5/5 powerpc/numa: Remove duplicate RECLAIM_DISTANCE definition

In reply to Anton Blanchard

We have two identical definitions of RECLAIM_DISTANCE, looks like the patch got applied twice. Remove one.

---

arch/powerpc/include/asm/topology.h +0 -10
Index: linux-2.6-work/arch/powerpc/include/asm/topology.h
===================================================================
@@ -19,16 +19,6 @@ struct device_node;
 #define RECLAIM_DISTANCE 10
 
 /*
- * Before going off node we want the VM to try and reclaim from the local
- * node. It does this if the remote distance is larger than RECLAIM_DISTANCE.
- * With the default REMOTE_DISTANCE of 20 and the default RECLAIM_DISTANCE of
- * 20, we never reclaim and go off node straight away.
- *
- * To fix this we choose a smaller value of RECLAIM_DISTANCE.
- */
-#define RECLAIM_DISTANCE 10
-
-/*
  * Avoid creating an extra level of balancing (SD_ALLNODES) on the largest
  * POWER7 boxes which have a maximum of 32 nodes.
  */
Acked-by on the v1 series
#6 lore raw
In reply to Anton Blanchard
Quoted 2 lines · Anton Blanchard

Here are a set of ppc64 scheduler fixes that help with some multi node performance issues.

They look fine to me. I'll probably ping you when I'll rip out all that SD_NODES_PER_DOMAIN crap for good, but until then I'm fine with you fiddling it for ppc64.

#7 lore raw

Hi Peter,

Quoted 9 lines · Anton Blanchard
Quoted 2 lines

Here are a set of ppc64 scheduler fixes that help with some multi node performance issues.

They look fine to me. I'll probably ping you when I'll rip out all that SD_NODES_PER_DOMAIN crap for good, but until then I'm fine with you fiddling it for ppc64.

Are you OK if Ben takes this, or would you prefer to send it via the scheduler tree?

Anton
--

[2/5] sched: Allow SD_NODES_PER_DOMAIN to be overridden

We want to override the default value of SD_NODES_PER_DOMAIN on ppc64, so move it into linux/topology.h.

---

include/linux/topology.h +4 -0
Index: linux-2.6-work/include/linux/topology.h
===================================================================
@@ -201,6 +201,10 @@ int arch_update_cpu_topology(void);
 	.balance_interval	= 64,					\
 }
 
+#ifndef SD_NODES_PER_DOMAIN
+#define SD_NODES_PER_DOMAIN 16
+#endif
+
 #ifdef CONFIG_SCHED_BOOK
 #ifndef SD_BOOK_INIT
 #error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!
kernel/sched.c +0 -2
Index: linux-2.6-work/kernel/sched.c
===================================================================
@@ -6938,8 +6938,6 @@ static int __init isolated_cpu_setup(cha
 
 __setup("isolcpus=", isolated_cpu_setup);
 
-#define SD_NODES_PER_DOMAIN 16
-
 #ifdef CONFIG_NUMA
 
 /**
#8 lore raw
Quoted 6 lines · Anton Blanchard

Hi Peter,

Quoted 4 lines · Anton Blanchard
Quoted 2 lines

Here are a set of ppc64 scheduler fixes that help with some multi node performance issues.

Quoted 8 lines
Quoted 5 lines

They look fine to me. I'll probably ping you when I'll rip out all that SD_NODES_PER_DOMAIN crap for good, but until then I'm fine with you fiddling it for ppc64.

Are you OK if Ben takes this, or would you prefer to send it via the scheduler tree?

I've already put it in my next branch that I'll stick on github later today hopefully :-)

Cheers,
Ben.

Quoted 45 lines

Anton
--

[2/5] sched: Allow SD_NODES_PER_DOMAIN to be overridden

We want to override the default value of SD_NODES_PER_DOMAIN on ppc64, so move it into linux/topology.h.

---

Index: linux-2.6-work/include/linux/topology.h
===================================================================

include/linux/topology.h +4 -0
@@ -201,6 +201,10 @@ int arch_update_cpu_topology(void);
 	.balance_interval	= 64,					\
 }
 
+#ifndef SD_NODES_PER_DOMAIN
+#define SD_NODES_PER_DOMAIN 16
+#endif
+
 #ifdef CONFIG_SCHED_BOOK
 #ifndef SD_BOOK_INIT
 #error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!

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

kernel/sched.c +0 -3
@@ -6938,8 +6938,6 @@ static int __init isolated_cpu_setup(cha
 
 __setup("isolcpus=", isolated_cpu_setup);
 
-#define SD_NODES_PER_DOMAIN 16
-
 #ifdef CONFIG_NUMA
 
 /**
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/