Skip to content

Commit ca1e8ee

Browse files
glemcoPeter Zijlstra
authored andcommitted
sched/deadline: Fix server stopping with runnable tasks
The deadline server can currently stop due to idle although fair tasks are runnable. This happens essentially when: * the server is set to idle, a task wakes up, the server stops * a task wakes up, the server sets itself to idle and stops right away Address both cases by clearing the server idle flag whenever a fair task wakes up and accounting also for pending tasks in the definition of idle. Fixes: f5a538c ("sched/deadline: Fix dl_server stop condition") Signed-off-by: Gabriele Monaco <gmonaco@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260113085159.114226-3-gmonaco@redhat.com
1 parent 1e0a2ba commit ca1e8ee

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

kernel/sched/deadline.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ update_stats_dequeue_dl(struct dl_rq *dl_rq, struct sched_dl_entity *dl_se, int
14201420

14211421
static void update_curr_dl_se(struct rq *rq, struct sched_dl_entity *dl_se, s64 delta_exec)
14221422
{
1423-
bool idle = rq->curr == rq->idle;
1423+
bool idle = idle_rq(rq);
14241424
s64 scaled_delta_exec;
14251425

14261426
if (unlikely(delta_exec <= 0)) {
@@ -1603,8 +1603,8 @@ void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec)
16031603
* | 8 | B:zero_laxity-wait | | |
16041604
* | | | <---+ |
16051605
* | +--------------------------------+ |
1606-
* | | ^ ^ 2 |
1607-
* | | 7 | 2 +--------------------+
1606+
* | | ^ ^ 2 |
1607+
* | | 7 | 2, 1 +----------------+
16081608
* | v |
16091609
* | +-------------+ |
16101610
* +-- | C:idle-wait | -+
@@ -1649,8 +1649,11 @@ void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec)
16491649
* dl_defer_idle = 0
16501650
*
16511651
*
1652-
* [1] A->B, A->D
1652+
* [1] A->B, A->D, C->B
16531653
* dl_server_start()
1654+
* dl_defer_idle = 0;
1655+
* if (dl_server_active)
1656+
* return; // [B]
16541657
* dl_server_active = 1;
16551658
* enqueue_dl_entity()
16561659
* update_dl_entity(WAKEUP)
@@ -1759,6 +1762,7 @@ void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec)
17591762
* "B:zero_laxity-wait" -> "C:idle-wait" [label="7:dl_server_update_idle"]
17601763
* "B:zero_laxity-wait" -> "D:running" [label="3:dl_server_timer"]
17611764
* "C:idle-wait" -> "A:init" [label="8:dl_server_timer"]
1765+
* "C:idle-wait" -> "B:zero_laxity-wait" [label="1:dl_server_start"]
17621766
* "C:idle-wait" -> "B:zero_laxity-wait" [label="2:dl_server_update"]
17631767
* "C:idle-wait" -> "C:idle-wait" [label="7:dl_server_update_idle"]
17641768
* "D:running" -> "A:init" [label="4:pick_task_dl"]
@@ -1784,6 +1788,7 @@ void dl_server_start(struct sched_dl_entity *dl_se)
17841788
{
17851789
struct rq *rq = dl_se->rq;
17861790

1791+
dl_se->dl_defer_idle = 0;
17871792
if (!dl_server(dl_se) || dl_se->dl_server_active)
17881793
return;
17891794

0 commit comments

Comments
 (0)