Re: Another SCHED_DEADLINE bug (with bisection and possible fix)

From: Luca Abeni
Date: Thu Jan 15 2015 - 08:35:55 EST


Hi Peter,

On 01/15/2015 01:23 PM, Peter Zijlstra wrote:
On Thu, Jan 15, 2015 at 12:23:43PM +0100, Luca Abeni wrote:
There are some parts of the patch that I do not understand (for example:
if I understand well, if the task is not throttled you set dl_new to 1...
And if it is throttled you change its current runtime and scheduling deadline...
Why?)
Anyway, I tested the patch and I confirm that it fixes the hang I originally
reported.

I'll go look at the patch in a wee bit. But Juri, Luca, could you
describe the correct behaviour?

From what I understand we should either modify the tasks run/sleep stats
when we change its parameters or we should schedule a delayed release of
the bandwidth delta (when it reaches its 0-lag point, if thats in the
future).
I suspect the correct behaviour can be difficult to implement:
- When a SCHED_DEADLINE task ends (or changes its scheduling policy to
something different), its bandwidth cannot be released immediately,
but should be released at the "0-lag time" (which reminds me about the
GRUB patches... I had to implement a similar behaviour in those patches :)
- The same applies when the task changes its scheduling parameters decreasing
its bandwidth. In this case, we also need to update the current runtime (if
it is larger than the new runtime, set it to the new maximum value - I think
this is the safest thing to do)
- When a task changes its parameters to increase its bandwidth, be do not
have such problems.

As far as I can see, if we apply the runtime / deadline changes starting from
the next reservation period we are safe (because the "0-lag time" is always
smaller than the current scheduling deadline).
This might cause some transient overloads (because if I change the parameters
of a task at time t, the update takes action a little bit later - at the next
scheduling deadline), but guarantees that a task never consumes more than
expected (for example: if a task continuously changes its bandwidth between
0.4 and 0.3, it will never consume more than 0.4. I suspect that if we
immediately update dl_se->deadline and dl_se->runtime a task can arrive to
consume much more CPU time).


Luca


Doing neither will allow one to game the reservation system afaict.


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