Re: Time slice for SCHED_BATCH ( CFS)

From: Peter Zijlstra
Date: Wed Feb 11 2009 - 08:00:50 EST


On Wed, 2009-02-11 at 17:58 +0530, J K Rai wrote:
> Can we say that given n cpus and m processes the time-slice will
> remain constant under SCHED_BATCH or so?

Only if those processes remain running, if they get blocked for whatever
reason it'll change.

> Can we form some kind of relationship?

Sure,

latency := 20ms * (1 + log2(nr_cpus))
min_granularity := 4ms * (1 + log2(nr_cpus))
nr_latency := floor(latency / min_granularity)


latency ; nr_running <= nr_latency
period = {
nr_running * min_granularity ; nr_running > nr_latency


slice = task_weight * period / runqueue_weight


as you can see, its a function of the number of cpus, as well as all
other running tasks on a particular cpu.

Load-balancing of course makes this an even more interesting thing.


--
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/