[PATCH 0/3] cleanup per rq tracking of admitted bandwidth

From: Luca Abeni
Date: Mon Feb 22 2016 - 05:57:29 EST


I know there are still open issues with select_fallback_rq() and
similar stuff, but as promised I worked on moving the __dl_*_ac() calls
from core.c to deadline.c (which is orthogonal respect to the
select_fallback_rq() thing). I post these patches so that people can
see how the code would look like after moving __dl_*_ac() calls to
deadline.c and can provide some comments; the patches are not submitted
for inclusion (yet).

All the following patches have to be applied over Juri's patch.


So, patch 0001 just moves two __dl_sub_ac() and __dl_add_ac()
invocations from dl_overflow() to deadline.c, using the
switched_from_dl() and switched_to_dl() methods. This should cover
the cases of tasks moving from SCHED_{OTHER,RT} to SCHED_DEADLINE
and vice-versa. The case in which the deadline parameters of a
task are changed still needs some __dl_* calls in dl_overflow().

These calls are moved to deadline.c patch 0002, which uses
prio_changed_dl()... Here, prio_changed_dl() needs to know the
"old" task utilization, while it is given the "old task
priority" (which, for a deadline task is equal to the current
priority)... So, I changed the meaning of the third parameter of
prio_changed_dl(), from "old priority" to "old utilization".
I know that changing the meaning of a parameter between different
scheduling classes might be a bad idea... But the "prio_changed" method
seems to be designed for priority-based schedulers only, and does not
provide good information to the SCHED_DEADLINE scheduling class... The
alternative is to change the prototype of the function, adding an
"oldbw" (or, better, "oldperiod" and "oldruntime") parameter.
Let me know what you think about this.

Notice that patch 0002 also contains two hunks that can be extracted
from it (if needed):
1) remove the call to switched_to_dl() from prio_changed_dl(): this
call seems to be useless
2) change __sched_setscheduler() to invoke prio_changed for deadline
tasks changing their parameters. Currently, this method is not
called (because when changing parameters deadline tasks do not
change their priority, so new_effective_prio == oldprio). I suspect
calling prio_changed is the correct behaviour; of course, this can
be done in different ways, let me know your opinion.

I tested patches 0001+0002 in various ways, and I do not see
regressions respect to Juri's patch (but I expect issues with
select_fallback_rq()... BTW, if anyone can provide some testcases for
it, I can try to fix that case too).

Finally, when playing with switched_to_dl() I realized that it can be
used to remove the dl_new field. So, I wrote patch 0003, which seems
to be working correctly, but I am probably missing some important
tests. Let me know what you think about it: I think it might be
a nice simplification of the code, but as usual I might be missing
something :)


Luca Abeni (4):
Move some calls to __dl_{sub,add}_ac() from core.c to deadline.c
Move the remaining __dl_{sub,add}_ac() calls from core.c to deadline.c
Remove dl_new

kernel/sched/core.c | 13 ++++++-------
kernel/sched/deadline.c | 43 +++++++++++++++++--------------------------
kernel/sched/sched.h | 5 +++++
3 files changed, 28 insertions(+), 33 deletions(-)

--
2.5.0