Commit 75b6499
sched/fair: Properly deactivate sched_delayed task upon class change
__sched_setscheduler() goes through an enqueue/dequeue cycle like so:
flags := DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK;
prev_class->dequeue_task(rq, p, flags);
new_class->enqueue_task(rq, p, flags);
when prev_class := fair_sched_class, this is followed by:
dequeue_task(rq, p, DEQUEUE_NOCLOCK | DEQUEUE_SLEEP);
the idea being that since the task has switched classes, we need to drop
the sched_delayed logic and have that task be deactivated per its previous
dequeue_task(..., DEQUEUE_SLEEP).
Unfortunately, this leaves the task on_rq. This is missing the tail end of
dequeue_entities() that issues __block_task(), which __sched_setscheduler()
won't have done due to not using DEQUEUE_DELAYED - not that it should, as
it is pretty much a fair_sched_class specific thing.
Make switched_from_fair() properly deactivate sched_delayed tasks upon
class changes via __block_task(), as if a
dequeue_task(..., DEQUEUE_DELAYED)
had been issued.
Fixes: 2e0199d ("sched/fair: Prepare exit/cleanup paths for delayed_dequeue")
Reported-by: "Paul E. McKenney" <[email protected]>
Reported-by: Chen Yu <[email protected]>
Signed-off-by: Valentin Schneider <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]1 parent 9c602ad commit 75b6499
1 file changed
+17
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5456 | 5456 | | |
5457 | 5457 | | |
5458 | 5458 | | |
| 5459 | + | |
| 5460 | + | |
| 5461 | + | |
| 5462 | + | |
| 5463 | + | |
| 5464 | + | |
| 5465 | + | |
5459 | 5466 | | |
5460 | 5467 | | |
5461 | 5468 | | |
| |||
5531 | 5538 | | |
5532 | 5539 | | |
5533 | 5540 | | |
5534 | | - | |
5535 | | - | |
5536 | | - | |
5537 | | - | |
5538 | | - | |
| 5541 | + | |
| 5542 | + | |
5539 | 5543 | | |
5540 | 5544 | | |
5541 | 5545 | | |
| |||
13107 | 13111 | | |
13108 | 13112 | | |
13109 | 13113 | | |
| 13114 | + | |
13110 | 13115 | | |
13111 | | - | |
| 13116 | + | |
| 13117 | + | |
| 13118 | + | |
| 13119 | + | |
| 13120 | + | |
| 13121 | + | |
13112 | 13122 | | |
13113 | | - | |
13114 | | - | |
| 13123 | + | |
13115 | 13124 | | |
13116 | 13125 | | |
13117 | 13126 | | |
| |||
0 commit comments