]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched_ext: Enable tick for finite slices on nohz_full
authorAndrea Righi <arighi@nvidia.com>
Wed, 8 Jul 2026 07:46:48 +0000 (09:46 +0200)
committerTejun Heo <tj@kernel.org>
Wed, 8 Jul 2026 18:29:43 +0000 (08:29 -1000)
commit4ec10f38ff901dc10503d57cbdcf941248419ac1
tree4aad1b8b5a15a3a6f13db234758221239cf121b9
parent18d62044cda7a2b40f59d910659c0b0d6accad37
sched_ext: Enable tick for finite slices on nohz_full

set_next_task_scx() updates the tick dependency before __schedule()
updates rq->curr. When switching from a non-EXT task, such as idle, to
an EXT task with a finite slice, sched_update_tick_dependency() checks
the outgoing task and can allow the tick to remain stopped.

The dependency can also be lost without a slice-type transition. After a
finite-slice task leaves the CPU idle, the enqueue path can clear the
dependency against the idle rq->curr. SCX_RQ_CAN_STOP_TICK still records
a finite slice, so another finite task skips the transition block and
can run without the ticks needed to expire its slice.

The reverse mismatch can also happen when the last finite-slice EXT task
is dequeued: sub_nr_running() updates the dependency before rq->curr
changes, so the outgoing task state can keep the dependency set after
the CPU goes idle.

Fix this by unconditionally enabling the scheduler tick whenever a
finite-slice EXT task is selected on a nohz_full CPU. Moreover, when the
last runnable EXT task leaves, ignore the outgoing EXT slice state so
the generic scheduler can correctly re-evaluate and clear the tick
dependency.

Fixes: 22a920209ab6 ("sched_ext: Implement tickless support")
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext/ext.c