mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
sched/core: Avoid requeueing a singleton balance callback
With proxy execution, __schedule() can call set_next_task_scx() with
SNT_REPICK and then SNT_PICK for the same donor. Both calls queue the
kick_sync balance callback while kick_sync_pending remains set.
When the callback is the only list entry, its next pointer is NULL, so
the existing duplicate check misses it. Queueing it again links it to
itself and causes the wait to run twice.
Also check whether the callback is already the head of the list to
reject the second insertion.
This covers the kick_sync callback because nothing else is queued
between SNT_REPICK and SNT_PICK. Requeueing the tail of a longer list
remains possible and is outside the scope of this fix.
Fixes: e2859566ff ("sched_ext: Queue the kick_sync wait from set_next_task_scx()")
Reported-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/08cac02c604dd73ef96fc92eb29d692b@kernel.org
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
9b5ce4345b
commit
3b1c7c74a6
|
|
@ -2175,7 +2175,8 @@ queue_balance_callback(struct rq *rq,
|
|||
* balance_push() is active, see the comment with
|
||||
* balance_push_callback.
|
||||
*/
|
||||
if (unlikely(head->next || rq->balance_callback == &balance_push_callback))
|
||||
if (unlikely(head->next || rq->balance_callback == head ||
|
||||
rq->balance_callback == &balance_push_callback))
|
||||
return;
|
||||
|
||||
head->func = func;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user