summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorAndrea Righi <arighi@nvidia.com>2026-10-29 08:35:08 +0100
committerTejun Heo <tj@kernel.org>2026-10-29 07:25:25 -1000
commit6efda33405cddd78ff481146813fad18294bf386 (patch)
tree381cb5e01da003fbe19c5c1c2da1b8bb847ccd79 /tools/perf/scripts/python
parentaf4ed5682e62556beb399b76f2f1274ae1aad9e2 (diff)
sched_ext: Avoid unnecessary IMMED reenqueues on idle CPUs
When two IMMED tasks wake on an idle CPU, the kernel can unnecessarily send both back to BPF instead of keeping the first task ready to run. The first wakeup inserts a task into the local DSQ and raises rq->next_class to ext before the CPU leaves idle. The second insertion queues a reenqueue scan. rq_is_open() sees next_class == ext and reports the CPU unavailable, although it is still idle. The scan then reenqueues the head along with the task behind it, losing a placement that could have been honored on the next pick. Report the rq as open while the CPU is idle, even if a local insertion has already raised next_class to ext. This keeps the local DSQ head through the reenqueue scan while IMMED tasks behind it are returned to BPF. A local reproducer runs in a four-vCPU virtme-ng guest: two futex waiters pinned to CPU 0 are woken together from CPU 2, and the BPF scheduler inserts their wakeups into the local DSQ with SCX_ENQ_IMMED. Across 10000 pairs, kernel instrumentation counts 9776 unnecessary head reenqueues while the CPU is idle and next_class is ext. Keeping the idle CPU open eliminates these head reenqueues. Fixes: 98d709cba319 ("sched_ext: Implement SCX_ENQ_IMMED") Reported-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/1548cc9309a6e0894e358262e0b3d4ee@kernel.org Signed-off-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions