sched: wakeup profile for sd-wake-affine optimization

From: Ken Chen
Date: Tue Dec 16 2008 - 02:01:21 EST


Hi,

We continue seeing problems with wake-affine load balance heuristics on our
workloads. I did some instrumentation on application wake-up profile and I
thought it would be good to share the result with the kernel community.

First attached is a 3D surface plot of wake-up initiator, target, and their
occurrence. (wakeup-surface.png). x-axis is the source of wakeup initiator
(the one that sends the wakeup event), y-axis is the target of the wakeup
(the one that got woken up). z-axis is the occurrence count. From the
graph, it is clear that the distribution of wakeup initiators is non-uniform.
There is clearly one small cluster of sources waking up one small cluster
of targets. Besides the two peaks in the surface graph, the other area are
not flat either, further indicates non-uniformity in wakeup distribution
profile.

2nd graph is a flattened 3d surface with the same data. Each line is a
source of wakeup initiator, x-axis is the target and y-axis is number of
wakeup events. This graph distinctively showed that there is one wakeup
initiator (irq context) wakes up two target threads (tid 6149 and 6191)
while there are no other initiator wakes up these two targets.

With sd-wake-affine, what happened is that these two target threads got
pulled to only *one* cpu due to wakeup initiator are more likely to be
executed only on a small set of CPU in the system. And there are no other
source to load balance it back and spread these two threads execution on
multiple CPUs. The end result is that we see idle time as the system
couldn't load balance all runnable threads on all available CPUs.

I was hoping that smart people here on LKML can brainstorm a solution.
My solution earlier was to introduce a sysctl to control sd-wake-affine
behavior, but that requires user to know what their application behavior
is and is not a desirable solution for general usage.

- Ken

Attachment: wakeup-surface.png
Description: PNG image

Attachment: wakeup-2d.png
Description: PNG image