Re: [patch] CFS scheduler, -v7

From: Ingo Molnar
Date: Thu May 03 2007 - 11:18:03 EST



* Ting Yang <tingy@xxxxxxxxxxxx> wrote:

> + s64 __delta = curr->fair_key - p->fair_key;
> +
> + /*
> + * Take scheduling granularity into account - do not
> + * preempt the current task unless the best task has
> + * a larger than sched_granularity fairness advantage:
> + */
> + if (__delta > niced_granularity(rq, curr, granularity))
> + resched_task(curr);
> +}
>
> This code actually now says, the difference of fair_key needed to
> preempt the current task is amplified by a facto of its weigh (in Al
> Boldi's example 32). However, the weighted task already advance its
> p->fair_key by its weight, (also 32 here). The combination of them
> becomes quadratic!

it's not quadratic in terms of CPU share: the first factor impacts the
CPU share, the second factor impacts the granularity. This means that
reniced workloads will be preempted in a more finegrained way - but
otherwise there's _no_ quadratic effect for CPU time - which is a
completely separate metric. Remember: there are no timeslices in CFS, so
a task can be preempted any number of times without being at a
disadvantage.

> Besides this quadratic effect, another minor issue amplified this
> a little bit further: p->wait_runtime accumulated before. [...]

actually, this 'minor issue' was the main issue that caused the bug ;-)

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