]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched_ext: Call wakeup_preempt() in local_dsq_post_enq()
authorKuba Piecuch <jpiecuch@google.com>
Tue, 28 Apr 2026 12:46:01 +0000 (12:46 +0000)
committerTejun Heo <tj@kernel.org>
Tue, 28 Apr 2026 16:28:48 +0000 (06:28 -1000)
commit163f8b7f9a84086c67c76aeadc04e6d43e32df6e
tree571d82152fb8e08455663c68d3b6dae14e8dc875
parentdeb7b2f93d0129b79425f830a1e5e7e1bb2c4973
sched_ext: Call wakeup_preempt() in local_dsq_post_enq()

There are several edge cases (see linked thread) where an IMMED task
can be left lingering on a local DSQ if an RT task swoops in at the
wrong time. All of these edge cases are due to rq->next_class being idle
even after dispatching a task to rq's local DSQ. We should bump
rq->next_class to &ext_sched_class as soon as we've inserted a task into
the local DSQ.

To optimize the common case of rq->next_class == &ext_sched_class,
only call wakeup_preempt() if rq->next_class is below EXT. If next_class
is EXT or above, wakeup_preempt() is a no-op anyway.

This lets us also simplify the preempt_curr() logic a bit since
wakeup_preempt() will call preempt_curr() for us if next_class is
below EXT.

Link: https://lore.kernel.org/all/DHZPHUFXB4N3.2RY28MUEWBNYK@google.com/
Signed-off-by: Kuba Piecuch <jpiecuch@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c