fix perf. bug in wake-up load balancing for aim7 and db workload
cover fix perf. bug in wake-up load balancing for aim7 and db workload
Commit d7102e95b7b9c00277562c29aad421d2d521c5f6 in linus's git tree
[PATCH] sched: filter affine wakeups
From: Nick Piggin <[email protected]>
Track the last waker CPU, and only consider wakeup-balancing if there's a match between current waker CPU and the previous waker CPU. This ensures that there is some correlation between two subsequent wakeup events before we move the task. Should help random-wakeup workloads on large SMP systems, by reducing the migration attempts by a factor of nr_cpus.
Apparently caused more than 10% performance regression for aim7 benchmark. The setup in use is 16-cpu HP rx8620, 64Gb of memory and 12 MSA1000s with 144 disks. Each disk is 72Gb with a single ext3 filesystem (courtesy of HP, who supplied benchmark results).
The problem is, for aim7, the wake-up pattern is random, but it still needs load balancing action in the wake-up path to achieve best performance. With the above commit, lack of load balancing hurts that workload.
However, for workloads like database transaction processing, the requirement is exactly opposite. In the wake up path, best performance is achieved with
absolutely zero load balancing. We simply wake up the process on the CPU
that it was previously run. Worst performance is obtained when we do load balancing at wake up.
There isn't an easy way to auto detect the workload characteristics. Ingo's earlier patch that detects idle CPU and decide whether to load balance or not doesn't perform with aim7 either since all CPUs are busy (it causes even bigger perf. regression).
We should back out the above commit and add a sysctl variable to control the behavior of load balancing in wake up path, so user can dynamically select a mode that best fit for the workload environment. And kernel can achieve best performance in two extreme ends of incompatible workload environments.
Two patches to follow.
- Ken
Quoted 12 lines · Kenneth W
Commit
d7102e95b7b9c00277562c29aad421d2d521c5f6in linus's git tree[PATCH] sched: filter affine wakeups
From: Nick Piggin <[email protected]>
Track the last waker CPU, and only consider wakeup-balancing if there's a match between current waker CPU and the previous waker CPU. This ensures that there is some correlation between two subsequent wakeup events before we move the task. Should help random-wakeup workloads on large SMP systems, by reducing the migration attempts by a factor ofnr_cpus.
Quoted 1 line
Apparently caused more than 10% performance regression for aim7 benchmark.
Post-mortem time. Why was it merged?
This patch was added to -mm on 8 November 2006. Was merged into mainline 12 January 2006. That's two months in -mm and one month in mainline.
I don't think it's reasonable to stretch the latency of scheduler patches to even longer than three months and I doubt if that'll solve the problem.
Oh well, at least we found it.
Quoted 5 lines
We should back out the above commit and add a sysctl variable to control the behavior of load balancing in wake up path, so user can dynamically select a mode that best fit for the workload environment. And kernel can achieve best performance in two extreme ends of incompatible workload environments.
Well I don't see any benchmark numbers in the original patch. Just an assertion that it "should" help something.
I'm more inclined to revert it and not add the sysctl (ugh) until we have a good reason to do so.
Quoted 5 lines · Andrew Morton
Well I don't see any benchmark numbers in the original patch. Just an assertion that it "should" help something.
The regression was in a Ken's commercial database benchmark. I couldn't reproduce it but presumably it did fix it otherwise Ken would would have piped up?
Quoted 3 lines
I'm more inclined to revert it and not add the sysctl (ugh) until we have a good reason to do so.
If you revert this then Ken's database benchmark gets worse. Hence the sysctl.
Signature · 2 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com
Quoted 4 lines · Nick Piggin
Quoted 2 lines · Andrew Morton
Quoted 8 lines
Quoted 3 lines
Well I don't see any benchmark numbers in the original patch. Just an assertion that it "should" help something.
The regression was in a Ken's commercial database benchmark. I couldn't reproduce it but presumably it did fix it otherwise Ken would would have piped up?
BTW, I did actually ask that you hold off merging it until Ken came back with some numbers.
Signature · 2 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com
Quoted 10 lines · Nick Piggin
Quoted 8 lines · Nick Piggin
Quoted 5 lines · Andrew Morton
Well I don't see any benchmark numbers in the original patch. Just an assertion that it "should" help something.
Quoted 8 lines
Quoted 4 lines
The regression was in a Ken's commercial database benchmark. I couldn't reproduce it but presumably it did fix it otherwise Ken would would have piped up?
BTW, I did actually ask that you hold off merging it until Ken came back with some numbers.
So you did.
Quoted 7 lines · Nick Piggin
Quoted 4 lines
I'm more inclined to revert it and not add the sysctl (ugh) until we have a good reason to do so.
If you revert this then Ken's database benchmark gets worse. Hence the sysctl.
Putting that knob in there hurts. There's just no way in which we can autodetect the right setting?
Ho hum. Well could someone please resend Ken's sysctl-knob patch, this time
a) with a good changelog which is useful to people who write things to /proc. ie: end users, not scheduler hackers and
b) with an update to Documentation/kernel-parameters.txt and
c) if poss, with a better name? Something which describes what its effect is upon the overall system not its effect upon mysterious scheduler internals.
If this thing is to be useful to administrators, they actually have to have a chance of understanding what it does.
Thanks.
Nick Piggin wrote on Monday, February 13, 2006 7:44 PM
Quoted 7 lines
Quoted 3 lines · Andrew Morton
Well I don't see any benchmark numbers in the original patch. Just an assertion that it "should" help something.
The regression was in a Ken's commercial database benchmark. I couldn't reproduce it but presumably it did fix it otherwise Ken would would have piped up?
I wasn't entirely happy though ;-)
Quoted 6 lines
Quoted 3 lines
I'm more inclined to revert it and not add the sysctl (ugh) until we have a good reason to do so.
If you revert this then Ken's database benchmark gets worse. Hence the sysctl.
Yes, Nick is correct. For db workload, the wake-ups type are mixed. Some of them are random, some of them are not because we do interrupt binding. The break down between random/fixed is about 30/70. Thus, Nick's patch helps 30% of time. With sysctl, we can regain the entire up side for db workload while retain workload on the other end of spectrum.
- Ken
Andrew Morton wrote on Monday, February 13, 2006 7:39 PM
Quoted 9 lines
Post-mortem time. Why was it merged?
This patch was added to -mm on 8 November 2006. Was merged into mainline 12 January 2006. That's two months in -mm and one month in mainline.
I don't think it's reasonable to stretch the latency of scheduler patches to even longer than three months and I doubt if that'll solve the problem.
Oh well, at least we found it.
I guess I'm the one to blame :-( Our kernel performance project needs to be more active in testing pending performance patches that sits in -mm.
Quoted 10 lines
Quoted 4 lines
We should back out the above commit and add a sysctl variable to control the behavior of load balancing in wake up path, so user can dynamically select a mode that best fit for the workload environment. And kernel can achieve best performance in two extreme ends of incompatible workload environments.
Well I don't see any benchmark numbers in the original patch. Just an assertion that it "should" help something.
I'm more inclined to revert it and not add the sysctl (ugh) until we have a good reason to do so.
The discussion on wake-up load balancing started July 28 last year [1]. In that post, it was outlined that the performance patch gave 2.3% gain for db transaction processing workload. It was then followed up by a couple of iterations, including one from Ingo[2] and one from Nick[3].
I think we just demonstrated that there are two workloads exist today which has completely opposite requirement on load balancing in the wake up path. People has tried to make kernel smart and detect work- load environment, but so far it hasn't worked. And hence the sysctl that I'm proposing right now.
[1] http://marc.theaimsgroup.com/?l=linux-kernel&m=112259224917701&w=2
[2] http://marc.theaimsgroup.com/?l=linux-kernel&m=112265450426975&w=2
[3] http://marc.theaimsgroup.com/?l=linux-kernel&m=113051195601837&w=2
Ingo Molnar
Acked-byQuoted 10 lines · Andrew Morton
Quoted 4 lines
We should back out the above commit and add a sysctl variable to control the behavior of load balancing in wake up path, so user can dynamically select a mode that best fit for the workload environment. And kernel can achieve best performance in two extreme ends of incompatible workload environments.
Well I don't see any benchmark numbers in the original patch. Just an assertion that it "should" help something.
I'm more inclined to revert it and not add the sysctl (ugh) until we have a good reason to do so.
yeah, we should do the revert:
but i'm quite against a sysctl knob. Especially not for 2.6.16.
Ingo