diff options
author | Joel Fernandes (Google) <joel@joelfernandes.org> | 2024-03-05 18:28:31 -0500 |
---|---|---|
committer | Joel Fernandes (Google) <joel@joelfernandes.org> | 2024-03-08 01:00:44 -0500 |
commit | 6890cea305eadbebc9f3fcf8d31c6672af797ee5 (patch) | |
tree | 37913bdf5ae22893995137d0c2a720764392e7a7 | |
parent | 8e2b05baa4dff13f41cd45cd3020734fa29e0f20 (diff) | |
download | linux-sched/dlserver.debug.mar3.2024.tar.gz |
sched/deadline: Do not mark defer_armed if timer not started in replenishsched/dlserver.debug.mar3.2024
For whatever reason, if start_dl_timer() returned 0 (it did not start
a new timer), then do not marked dl_defer_armed, because we never really
armed.
This is similar to what dl_check_constrained_dl() does.
Add some guardrails for such situations.
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
-rw-r--r-- | kernel/sched/deadline.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index e1d0c35f8f29c..fb44bfc0a3b3b 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -860,7 +860,16 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se) if (!is_dl_boosted(dl_se)) { dl_se->dl_defer_armed = 1; dl_se->dl_throttled = 1; - start_dl_timer(dl_se); + if (!start_dl_timer(dl_se)) { + /* + * If for whatever reason (delays), if a previous timer was + * queued but not serviced, cancel it. + */ + hrtimer_try_to_cancel(&dl_se->dl_timer); + dl_se->dl_defer_armed = 0; + dl_se->dl_throttled = 0; + return; + } } } } @@ -1413,7 +1422,14 @@ static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64 hrtimer_try_to_cancel(&dl_se->dl_timer); replenish_dl_new_period(dl_se, dl_se->rq); - start_dl_timer(dl_se); + + /* + * Not being able to start the timer seems problematic. If it could not + * be started for whatever reason, we need to "unthrottle" the DL server + * and queue right away. Otherwise nothing might queue it. That's similar + * to what enqueue_dl_entity() does on start_dl_timer==0. For now, just warn. + */ + WARN_ON_ONCE(!start_dl_timer(dl_se)); return; } |