Skip to contentSkip to conversation

BLD-3.17 release.

ANNOUNCE Rakib Mullick 2 participants 5 messages Oct 11, 2014 – Oct 14, 2014 Scheduler

lore
Share & tools
lore
#0 lore raw

BLD (The Barbershop Load Distribution Algorithm) patch for Linux 3.17 , this version contains a build fix when CONFIG_BLD=n. I have recently done some netperf benchmark (actually I did prevously too but never publish) below shows the stat of default netperf run on localhost system (client/server) running on local system (core i3, 2g mem, higher is better).

tcp_stream tcp_rr udp_stream udp_rr

mainline 9343.54 20812.03 18231.74 24396.074

				   18210.71

bld 14738.35 29224.54 26475.75 34910.08

				   26462.53

These are average of 5 runs of each tests. BLD performs better and shows ~(35-40)% improvement. Config used for this benchmark could be found at the following link:

https://raw.githubusercontent.com/rmullick/bld-patches/master/config.benchmark-3.17

And, recently Luis Cruz backports BLD's previous release BLD-3.16 for Android and experimentally ran it on his galaxy SIII, these could be found at following link:

https://github.com/SyNtheticNightmar3/bld-patches

If you are interested in running it on Android, take a look at the above link.

Thanks,
Rakib

---

init/Kconfig +9 -0
index 80a6907..65319c6 100644
@@ -36,6 +36,15 @@ config BROKEN_ON_SMP
 	depends on BROKEN || !SMP
 	default y
 
+config BLD
+	bool "An alternate CPU load distribution technique for task scheduler"
+	depends on SMP
+	default y
+	help
+	  This is an alternate CPU load distribution technique based for task
+	  scheduler based on The Barbershop Load Distribution algorithm. Not
+	  suitable for NUMA, should work well on SMP.
+
 config INIT_ENV_ARG_LIMIT
 	int
 	default 32 if !UML
kernel/sched/bld.h new file +207 -0

207 lines not on this page · raw message

kernel/sched/core.c +45 -2

143 lines not on this page · raw message

kernel/sched/fair.c +42 -30

158 lines not on this page · raw message

kernel/sched/rt.c +4 -0
index 5f6edca..ea0946c 100644
@@ -1295,6 +1295,7 @@ static void yield_task_rt(struct rq *rq)
 #ifdef CONFIG_SMP
 static int find_lowest_rq(struct task_struct *task);
 
+#ifndef	CONFIG_BLD
 static int
 select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
 {
@@ -1348,6 +1349,7 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags)
 out:
 	return cpu;
 }
+#endif	/* CONFIG_BLD */
 
 static void check_preempt_equal_prio(struct rq *rq, struct task_struct *p)
 {
@@ -2112,7 +2114,9 @@ const struct sched_class rt_sched_class = {
 	.put_prev_task		= put_prev_task_rt,
 
 #ifdef CONFIG_SMP
+#ifndef	CONFIG_BLD
 	.select_task_rq		= select_task_rq_rt,
+#endif
 
 	.set_cpus_allowed       = set_cpus_allowed_rt,
 	.rq_online              = rq_online_rt,
kernel/sched/sched.h +11 -3
index 579712f..a00914d 100644
@@ -358,9 +358,8 @@ struct cfs_rq {
 #endif /* CONFIG_FAIR_GROUP_SCHED */
 #endif /* CONFIG_SMP */
 
-#ifdef CONFIG_FAIR_GROUP_SCHED
 	struct rq *rq;	/* cpu runqueue to which this cfs_rq is attached */
-
+#ifdef CONFIG_FAIR_GROUP_SCHED
 	/*
 	 * leaf cfs_rqs are those that hold tasks (lowest schedulable entity in
 	 * a hierarchy). Non-leaf lrqs hold other higher schedulable entities
@@ -384,6 +383,11 @@ struct cfs_rq {
 	struct list_head throttled_list;
 #endif /* CONFIG_CFS_BANDWIDTH */
 #endif /* CONFIG_FAIR_GROUP_SCHED */
+
+#ifdef CONFIG_BLD
+	struct list_head bld_cfs_list;
+	char pos;
+#endif
 };
 
 static inline int rt_bandwidth_enabled(void)
@@ -417,12 +421,16 @@ struct rt_rq {
 	/* Nests inside the rq lock: */
 	raw_spinlock_t rt_runtime_lock;
 
+	struct rq *rq;
 #ifdef CONFIG_RT_GROUP_SCHED
 	unsigned long rt_nr_boosted;
 
-	struct rq *rq;
 	struct task_group *tg;
 #endif
+#ifdef CONFIG_BLD
+	struct list_head bld_rt_list;
+	int lowbit;
+#endif
 };
 
 /* Deadline class' related fields in a runqueue */
#1 lore raw
Quoted 1 line · Rakib Mullick

BLD (The Barbershop Load Distribution Algorithm) patch for Linux 3.17

I had a curiosity attack, played with it a little.

My little Q6600 box could be describes as being "micro-numa", with two pathetic little "nodes" connected by the worst interconnect this side of tin cans and string. Communicating tasks sorely missed sharing cache.

tbench
3.18.0-master

Throughput 287.411 MB/sec  1 clients  1 procs  max_latency=1.614 ms     1.000
Throughput 568.631 MB/sec  2 clients  2 procs  max_latency=1.942 ms     1.000
Throughput 1069.75 MB/sec  4 clients  4 procs  max_latency=18.494 ms    1.000
Throughput 1040.99 MB/sec  8 clients  8 procs  max_latency=17.364 ms    1.000
3.18.0-master-BLD                                                        vs master
Throughput 261.986 MB/sec  1 clients  1 procs  max_latency=11.943 ms     .911
Throughput 264.461 MB/sec  2 clients  2 procs  max_latency=11.884 ms     .465
Throughput 476.191 MB/sec  4 clients  4 procs  max_latency=11.497 ms     .445
Throughput 558.236 MB/sec  8 clients  8 procs  max_latency=9.008 ms      .536

TCP_RR 4 unbound clients
3.18.0-master
TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 127.0.0.1 (127.0.0.1) port 0 AF_INET Local /Remote

Socket Size   Request  Resp.   Elapsed  Trans.
Send   Recv   Size     Size    Time     Rate         
bytes  Bytes  bytes    bytes   secs.    per sec   
16384  87380  1        1       30.00    72436.65 
16384  87380  1        1       30.00    72438.55
16384  87380  1        1       30.00    72213.18
16384  87380  1        1       30.00    72493.48
                               sum     289581.86     1.000

3.18.0-master-BLD
TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 127.0.0.1 (127.0.0.1) port 0 AF_INET Local /Remote

Socket Size   Request  Resp.   Elapsed  Trans.
Send   Recv   Size     Size    Time     Rate         
bytes  Bytes  bytes    bytes   secs.    per sec   
16384  87380  1        1       30.00    29014.09
16384  87380  1        1       30.00    28804.53
16384  87380  1        1       30.00    28999.40
16384  87380  1        1       30.00    28901.84
                               sum     115719.86      .399 vs master
#2 lore raw
Quoted 5 lines · Mike Galbraith
Quoted 1 line · Rakib Mullick

BLD (The Barbershop Load Distribution Algorithm) patch for Linux 3.17

I had a curiosity attack, played with it a little.

Thanks for showing your interest!

Quoted 50 lines

My little Q6600 box could be describes as being "micro-numa", with two pathetic little "nodes" connected by the worst interconnect this side of tin cans and string. Communicating tasks sorely missed sharing cache.

tbench
3.18.0-master
Throughput 287.411 MB/sec 1 clients 1 procs max_latency=1.614 ms 1.000
Throughput 568.631 MB/sec 2 clients 2 procs max_latency=1.942 ms 1.000
Throughput 1069.75 MB/sec 4 clients 4 procs max_latency=18.494 ms 1.000
Throughput 1040.99 MB/sec 8 clients 8 procs max_latency=17.364 ms 1.000

3.18.0-master-BLD vs
master
Throughput 261.986 MB/sec 1 clients 1 procs max_latency=11.943 ms .911
Throughput 264.461 MB/sec 2 clients 2 procs max_latency=11.884 ms .465
Throughput 476.191 MB/sec 4 clients 4 procs max_latency=11.497 ms .445
Throughput 558.236 MB/sec 8 clients 8 procs max_latency=9.008 ms .536

TCP_RR 4 unbound clients
3.18.0-master
TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 127.0.0.1 (127.0.0.1) port 0 AF_INET
Local /Remote

Socket Size   Request  Resp.   Elapsed  Trans.
Send   Recv   Size     Size    Time     Rate
bytes  Bytes  bytes    bytes   secs.    per sec
16384  87380  1        1       30.00    72436.65
16384  87380  1        1       30.00    72438.55
16384  87380  1        1       30.00    72213.18
16384  87380  1        1       30.00    72493.48
                               sum     289581.86     1.000

3.18.0-master-BLD
TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 127.0.0.1 (127.0.0.1) port 0 AF_INET
Local /Remote

Socket Size   Request  Resp.   Elapsed  Trans.
Send   Recv   Size     Size    Time     Rate
bytes  Bytes  bytes    bytes   secs.    per sec
Quoted 7 lines
16384  87380  1        1       30.00    29014.09
16384  87380  1        1       30.00    28804.53
16384  87380  1        1       30.00    28999.40
16384  87380  1        1       30.00    28901.84
                               sum     115719.86      .399 vs master

Okay. From the numbers above it's apparent that BLD isn't doing good, atleast for the
kind of system that you have been using. I didn't had a chance to ran it on any kind of
NUMA systems, for that reason on Kconfig, I've marked it as "Not suitable for NUMA", yet.
Part of the reason is, I didn't manage to try it out myself and other reason is, it's easy to
get things wrong if schedule domains are build improperly. I'm not sure what was the
sched configuration in your case. BLD assumes (or kindof bliendly believes systems
default sched domain topology) on wakeup tasks are cache hot and so don't put those
task's on other sched domains, but if that isn't the case then perhaps it'll miss out on
balancing oppourtunity, in that case CPU utilization will be improper.

Can you please share the perf stat of netperf runs? So, far I have seen reduced context
switch numbers with -BLD with a drawback of huge increase of CPU migration numbers.
But, the kind of systems I ran so far, it deemed too much CPU movement didn't cost much.
But, it could be wrong for NUMA systems.

Thanks,
Rakib

#3 lore raw
Quoted 6 lines · Rakib Mullick

Okay. From the numbers above it's apparent that BLD isn't doing good, atleast for the
kind of system that you have been using. I didn't had a chance to ran it on any kind of
NUMA systems, for that reason on Kconfig, I've marked it as "Not suitable for NUMA", yet.

(yeah, a NUMA box would rip itself to shreds)

Quoted 11 lines

Part of the reason is, I didn't manage to try it out myself and other reason is, it's easy to
get things wrong if schedule domains are build improperly. I'm not sure what was the
sched configuration in your case. BLD assumes (or kindof bliendly believes systems
default sched domain topology) on wakeup tasks are cache hot and so don't put those
task's on other sched domains, but if that isn't the case then perhaps it'll miss out on
balancing oppourtunity, in that case CPU utilization will be improper.

Even when you have only one socket with a big L3, you don't really want to bounce fast/light tasks around too frequently, L2 misses still hurt.

Quoted 4 lines

Can you please share the perf stat of netperf runs? So, far I have seen reduced context
switch numbers with -BLD with a drawback of huge increase of CPU migration numbers.

No need, it's L2 misses. Q6600 has no L3 to mitigate the miss pain.

Quoted 3 lines

But, the kind of systems I ran so far, it deemed too much CPU movement didn't cost much.
But, it could be wrong for NUMA systems.

You can most definitely move even very fast/light tasks too much within an L3, L2 misses can demolish throughput. We had that problem.

-Mike

#4 lore raw
Quoted 26 lines · Mike Galbraith
Quoted 6 lines · Rakib Mullick

Okay. From the numbers above it's apparent that BLD isn't doing good, atleast for the
kind of system that you have been using. I didn't had a chance to ran it on any kind of
NUMA systems, for that reason on Kconfig, I've marked it as "Not suitable for NUMA", yet.

(yeah, a NUMA box would rip itself to shreds)

Quoted 11 lines

Part of the reason is, I didn't manage to try it out myself and other reason is, it's easy to
get things wrong if schedule domains are build improperly. I'm not sure what was the
sched configuration in your case. BLD assumes (or kindof bliendly believes systems
default sched domain topology) on wakeup tasks are cache hot and so don't put those
task's on other sched domains, but if that isn't the case then perhaps it'll miss out on
balancing oppourtunity, in that case CPU utilization will be improper.

Even when you have only one socket with a big L3, you don't really want to bounce fast/light tasks around too frequently, L2 misses still hurt.

Quoted 7 lines
Quoted 4 lines

Can you please share the perf stat of netperf runs? So, far I have seen reduced context
switch numbers with -BLD with a drawback of huge increase of CPU migration numbers.

No need, it's L2 misses. Q6600 has no L3 to mitigate the miss pain.

I see.

Quoted 7 lines
Quoted 3 lines

But, the kind of systems I ran so far, it deemed too much CPU movement didn't cost much.
But, it could be wrong for NUMA systems.

You can most definitely move even very fast/light tasks too much within an L3, L2 misses can demolish throughput. We had that problem.

So, L2 misses is the key here. So far I haven't tried to utilize various sched domain flags, like. SD_SHARE_PKG_RESOURCE/_CPUPOWER etc. Probably, integrating those might help? I'll take a look at those and will try to see what happens, although testing will be problematic.

Thanks,
Rakib.