* [PATCH v2] sched/fair: Don't let task_tick_fair() IPI isolated CPUs
@ 2026-11-25 10:53 Valentin Schneider
0 siblings, 0 replies; only message in thread
From: Valentin Schneider @ 2026-11-25 10:53 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Ingo Molnar, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
K Prateek Nayak
From: Peter Zijlstra <peterz@infradead.org>
While testing some CPU isolation / NOHZ_FULL stuff I stumbled on something
like so:
kworker/u289:5-241489 [001] d..3. 2963.728734: ipi_send_cpu: cpu=6 callsite=task_work_add+0x84 callback=0x0
kworker/u289:5-241489 [001] d..3. 2963.728735: kernel_stack: <stack trace >
=> trace_event_raw_event_ipi_send_cpu (ffffffffa6d7ba45)
=> kick_process (ffffffffa6d827a2)
=> task_work_add (ffffffffa6d645c4)
=> task_tick_fair (ffffffffa6d9cfbe)
=> sched_tick_remote (ffffffffa6d84c69)
=> process_one_work (ffffffffa6d5d57b)
=> worker_thread (ffffffffa6d5e1af)
=> kthread (ffffffffa6d66e85)
=> ret_from_fork (ffffffffa6cb3f2b)
=> ret_from_fork_asm (ffffffffa6c7741a)
In this case CPU6 is isolated via isolcpus=, and is executing a single pure
userspace task, so should be fully leveraging dynticks.
However, because that task is SCHED_OTHER, housekeeping CPUs periodically
handle a sched_tick_remote() on its behalf, and end up kicking that task
out of userspace to run the task_cache_work().
task_tick_numa() causes the same pattern, one or the other may show up
depending on the timing of their respective balancing periods.
Let task_tick_fair() recognize when it is run against a fully isolated
CPU (no sched_domain) and return early to skip the load-balancing related
functions.
Not-signed-off-by: Peter Zijlstra <peterz@infradead.org>
[Switched from RD to SD check]
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
v1 -> v2
========
o Ditched sched_tick_remote() logic
o Included task_tick_numa()
---
kernel/sched/fair.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 731d78155e654..bd6815c2e21a5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4588,6 +4588,9 @@ static void task_tick_numa(struct rq *rq, struct task_struct *curr)
struct callback_head *work = &curr->numa_work;
u64 period, now;
+ if (!static_branch_unlikely(&sched_numa_balancing))
+ return;
+
/*
* We don't care about NUMA placement if we don't have memory.
*/
@@ -15401,15 +15404,17 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int hrtick)
if (hrtick)
return;
- if (static_branch_unlikely(&sched_numa_balancing))
- task_tick_numa(rq, curr);
+ task_tick_core(rq, curr);
+ /* If there is no SD; there is no balancing, and none of this matters */
+ if (!rcu_dereference_sched_domain(rq->sd))
+ return;
+
+ task_tick_numa(rq, curr);
task_tick_cache(rq, curr);
update_misfit_status(curr, rq);
check_update_overutilized_status(task_rq(curr));
-
- task_tick_core(rq, curr);
}
/*
--
2.56.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-25 10:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 10:53 [PATCH v2] sched/fair: Don't let task_tick_fair() IPI isolated CPUs Valentin Schneider
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®