]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched_ext: Fix local_dsq_post_enq() to use task's scheduler in sub-sched
authorzhidao su <suzhidao@xiaomi.com>
Thu, 23 Apr 2026 02:58:32 +0000 (10:58 +0800)
committerTejun Heo <tj@kernel.org>
Thu, 23 Apr 2026 16:36:56 +0000 (06:36 -1000)
commit4e3d7c89e15ac5dbf45b7d7a49bb374650c03339
treefaefa7941bc8ef256d3ef7866798db61c62b6ec4
parent05909810a946222aca5d0611d37be82d18f95228
sched_ext: Fix local_dsq_post_enq() to use task's scheduler in sub-sched

local_dsq_post_enq() calls call_task_dequeue() with scx_root instead of
the scheduler instance actually managing the task. When
CONFIG_EXT_SUB_SCHED is enabled, tasks may be managed by a sub-scheduler
whose ops.dequeue() callback differs from root's. Using scx_root causes
the wrong scheduler's ops.dequeue() to be consulted: sub-sched tasks
dispatched to a local DSQ via scx_bpf_dsq_move_to_local() will have
SCX_TASK_IN_CUSTODY cleared but the sub-scheduler's ops.dequeue() is
never invoked, violating the custody exit semantics.

Fix by adding a 'struct scx_sched *sch' parameter to local_dsq_post_enq()
and move_local_task_to_local_dsq(), and propagating the correct scheduler
from their callers dispatch_enqueue(), move_task_between_dsqs(), and
consume_dispatch_q().

This is consistent with dispatch_enqueue()'s non-local path which already
passes 'sch' directly to call_task_dequeue() for global/bypass DSQs.

Fixes: ebf1ccff79c4 ("sched_ext: Fix ops.dequeue() semantics")
Signed-off-by: zhidao su <suzhidao@xiaomi.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c