mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
sched_ext: Fix the running task keeping its protection into bypass
Protection ends when the scheduler enters bypass, so that bypass scheduling
can cut every task's slice. scx_bypass() clears it for the queued tasks by
cycling them, and strips the running task's in the same walk over
rq->scx.runnable_list. The running task is never on that list.
set_next_task_scx() takes it off and put_prev_task_scx() puts it back, so
the strip never runs. A protected running task then keeps its slice into
bypass, where the tick's attempts to cut it are refused.
Strip the running task's protection outside the walk.
Fixes: 9cfc6ab34a ("sched_ext: Add SCX_TASK_PROTECTED")
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
This commit is contained in:
parent
43e1ef14a4
commit
30fb2b1e4d
|
|
@ -6318,6 +6318,16 @@ void scx_bypass(struct scx_sched *sch, bool bypass)
|
|||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bypass trumps protection. Cycling the queued tasks below
|
||||
* clears theirs. The current task isn't on the runnable list,
|
||||
* so strip its protection here.
|
||||
*/
|
||||
p = rq->curr;
|
||||
if (bypass && p->sched_class == &ext_sched_class &&
|
||||
scx_is_descendant(scx_task_sched(p), sch))
|
||||
scx_task_slice_ended(rq, p);
|
||||
|
||||
/*
|
||||
* The use of list_for_each_entry_safe_reverse() is required
|
||||
* because each task is going to be removed from and added back
|
||||
|
|
@ -6330,13 +6340,6 @@ void scx_bypass(struct scx_sched *sch, bool bypass)
|
|||
if (!scx_is_descendant(scx_task_sched(p), sch))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Bypass trumps protection. Cycling clears for queued
|
||||
* tasks but current task needs explicit stripping.
|
||||
*/
|
||||
if (bypass && task_current(rq, p))
|
||||
scx_task_slice_ended(rq, p);
|
||||
|
||||
/* cycling deq/enq is enough, see the function comment */
|
||||
scoped_guard (sched_change, p, DEQUEUE_SAVE | DEQUEUE_MOVE) {
|
||||
/* nothing */ ;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user