linux/tools/sched_ext
Tejun Heo 22a920209a sched_ext: Implement tickless support
Allow BPF schedulers to indicate tickless operation by setting p->scx.slice
to SCX_SLICE_INF. A CPU whose current task has infinte slice goes into
tickless operation.

scx_central is updated to use tickless operations for all tasks and
instead use a BPF timer to expire slices. This also uses the SCX_ENQ_PREEMPT
and task state tracking added by the previous patches.

Currently, there is no way to pin the timer on the central CPU, so it may
end up on one of the worker CPUs; however, outside of that, the worker CPUs
can go tickless both while running sched_ext tasks and idling.

With schbench running, scx_central shows:

  root@test ~# grep ^LOC /proc/interrupts; sleep 10; grep ^LOC /proc/interrupts
  LOC:     142024        656        664        449   Local timer interrupts
  LOC:     161663        663        665        449   Local timer interrupts

Without it:

  root@test ~ [SIGINT]# grep ^LOC /proc/interrupts; sleep 10; grep ^LOC /proc/interrupts
  LOC:     188778       3142       3793       3993   Local timer interrupts
  LOC:     198993       5314       6323       6438   Local timer interrupts

While scx_central itself is too barebone to be useful as a
production scheduler, a more featureful central scheduler can be built using
the same approach. Google's experience shows that such an approach can have
significant benefits for certain applications such as VM hosting.

v4: Allow operation even if BPF_F_TIMER_CPU_PIN is not available.

v3: Pin the central scheduler's timer on the central_cpu using
    BPF_F_TIMER_CPU_PIN.

v2: Convert to BPF inline iterators.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: David Vernet <dvernet@meta.com>
Acked-by: Josh Don <joshdon@google.com>
Acked-by: Hao Luo <haoluo@google.com>
Acked-by: Barret Rhoden <brho@google.com>
2024-06-18 10:09:19 -10:00
..
include sched_ext: Implement scx_bpf_kick_cpu() and task preemption support 2024-06-18 10:09:19 -10:00
.gitignore sched_ext: Add scx_simple and scx_example_qmap example schedulers 2024-06-18 10:09:17 -10:00
Makefile sched_ext: Add a central scheduler which makes all scheduling decisions on one CPU 2024-06-18 10:09:19 -10:00
scx_central.bpf.c sched_ext: Implement tickless support 2024-06-18 10:09:19 -10:00
scx_central.c sched_ext: Implement tickless support 2024-06-18 10:09:19 -10:00
scx_qmap.bpf.c sched_ext: Make watchdog handle ops.dispatch() looping stall 2024-06-18 10:09:19 -10:00
scx_qmap.c sched_ext: Make watchdog handle ops.dispatch() looping stall 2024-06-18 10:09:19 -10:00
scx_show_state.py tools/sched_ext: Add scx_show_state.py 2024-06-18 10:09:18 -10:00
scx_simple.bpf.c sched_ext: Add scx_simple and scx_example_qmap example schedulers 2024-06-18 10:09:17 -10:00
scx_simple.c sched_ext: Print debug dump after an error exit 2024-06-18 10:09:18 -10:00