[PATCH v2 09/17] sched/core: Keep tick on non-preferred CPUs until tasks are out

From: Shrikanth Hegde

Date: Tue Apr 07 2026 - 15:23:43 EST


Enable tick on nohz full CPU when it is marked as non-preferred.
If there in no CFS/RT running there, disable the tick to save the power.

Steal time handling code will call tick_nohz_dep_set_cpu with
TICK_DEP_BIT_SCHED for moving the task out of nohz_full CPU fast.

Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
---
kernel/sched/core.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 336e7c694eb7..c7f046443dc5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1407,6 +1407,10 @@ bool sched_can_stop_tick(struct rq *rq)
if (rq->dl.dl_nr_running)
return false;

+ /* Keep the tick running until both RT and CFS are pushed out*/
+ if (!cpu_preferred(rq->cpu) && (rq->rt.rt_nr_running || rq->cfs.h_nr_queued))
+ return false;
+
/*
* If there are more than one RR tasks, we need the tick to affect the
* actual RR behaviour.
--
2.47.3