[PATCH v2 15/15] sched/deadline: Always start a new period if CFS exceeded DL runtime

From: Joel Fernandes (Google)
Date: Tue Mar 12 2024 - 21:28:39 EST


We believe that this is the right thing to do. The unit test
(cs_dlserver_test) also agrees. If we let the CFS run without starting a
new period, while the server is regularly throttled, then the test fails
because CFS does not appear to get enough bandwidth.

Intuitively, this makes sense to do as well. If CFS used up all the CFS
bandwidth, while the DL server was in a throttled state, it got the
bandwidth it wanted and some. Now, we can start all over from scratch to
guarantee it a minimum bandwidth.

Signed-off-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx>
---
kernel/sched/deadline.c | 17 -----------------
1 file changed, 17 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 179369d27f66..a0ea668ac1bf 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1454,23 +1454,6 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64
* starting a new period, pushing the activation to the zero-lax time.
*/
if (dl_se->dl_defer && dl_se->dl_throttled && dl_runtime_exceeded(dl_se)) {
- s64 runtime_diff = dl_se->runtime + dl_se->dl_runtime;
-
- /*
- * If this is a regular throttling case, let it run negative until
- * the dl_runtime - runtime > 0. The reason being is that the next
- * replenishment will result in a positive runtime one period ahead.
- *
- * Otherwise, the deadline will be pushed more than one period, not
- * providing runtime/period anymore.
- *
- * If the dl_runtime - runtime < 0, then the server was able to get
- * the runtime/period before the replenishment. So it is safe
- * to start a new deffered period.
- */
- if (!dl_se->dl_defer_armed && runtime_diff > 0)
- return;
-
hrtimer_try_to_cancel(&dl_se->dl_timer);

replenish_dl_new_period(dl_se, dl_se->rq);
--
2.34.1