Re: How how latent should non-preemptive scheduling be?

From: Sitsofe Wheeler
Date: Thu Sep 18 2008 - 03:26:35 EST


Peter Zijlstra wrote:
On Wed, 2008-09-17 at 14:54 -0700, Arjan van de Ven wrote:
On Wed, 17 Sep 2008 22:48:55 +0100

Cause Maximum

Percentage

Scheduler: waiting for cpu 208 msec 59.4 %


you're rather CPU bound, and your process was woken up but didn't run for over 200 milliseconds..
that sounds like a scheduler fairness issue!

Really hard subject. Perfect fairness requires 0 latency - which with a
CPU only being able to run one thing at a time is impossible. So what
latency ends up being is a measure for the convergence towards fairness.

Anyway - 200ms isn't too weird depending on the circumstances. We start
out with a 20ms latency for UP, we then multiply with 1+log2(nr_cpus)
which in say a quad core machine ends up with 60ms. That ought to mean
that under light load the max latency should not exceed twice that
(basically a consequence of the Nyquist-Shannon sampling theorem IIRC).

Now, if you get get under some load (by default: nr_running > 5) the
expected latency starts to linearly grow with nr_running.

From what I gather from the reply to this email the machine was not
doing much (and after having looked up the original email I see its a
eeeeeeeee atom - which is dual cpu iirc, so that yields 40ms default) -
so 200 is definately on the high side.

No, it's not an eeeeee atom. It's an eee celeron M (900Mhz) so it's definitely a single CPU with no hyperthreading (and SMP is not enabled in the kernel config either). It has less grunt that the atom and can't do cpu scaling either (although it seems to have C states).

The load average is less than 0.5 but obviously I don't know if it is periodically spiking over 5 and then smoothing out.

What you can do to investigate this, is use the sched_wakeup tracer from
ftrace, that should give a function trace of the highest wakeup latency
showing what the kernel is doing.

Thanks for the hint - I was wondering where to look next.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/