Skip to content

Add SCX_LAVD scheduler#102

Open
Yury-MonZon wants to merge 1 commit into
devfrom
cpu-scheduler
Open

Add SCX_LAVD scheduler#102
Yury-MonZon wants to merge 1 commit into
devfrom
cpu-scheduler

Conversation

@Yury-MonZon

Copy link
Copy Markdown
Contributor

Kernel (configs/minconfig-mainline):

  • CONFIG_SCHED_CLASS_EXT=y (sched_ext)
  • CONFIG_DEBUG_INFO_BTF=y, CONFIG_DEBUG_INFO_REDUCED off (BTF is required by SCHED_CLASS_EXT and by the scx BPF programs)
  • CONFIG_FTRACE_SYSCALLS=y (sys_enter_execve tracepoint used by scx_lavd)

Build environment:

  • Add dwarves (pahole) to Dockerfile and README kernel deps; BTF generation needs pahole >= 1.22 or olddefconfig silently drops it
  • build-kernel-mainline.sh: fail fast if pahole is missing/too old, instead of quietly shipping a BTF-less (sched_ext-less) kernel

Image (scx served from our apt repo):

  • Enable scx.service via multi-user.target.wants overlay symlink

Benchmarks (RK3576, 8-core big.LITTLE, on battery, screen off, scx_lavd v1.1.1 --autopower vs stock EEVDF):

Latency — schbench -m4 -t8 -r30 (wakeup latency):
p50 3532 us -> 26 us (135.85x faster)
p90 16112 us -> 3988 us (4.04x faster)
p99 31776 us -> 7976 us (3.98x faster)
p99.9 43200 us -> 18272 us (2.36x faster)

Throughput: -23% RPS under full saturation (latency/throughput trade).

Power — average watts at fixed load (long-settle fuel-gauge sampling):
idle 3.32 -> 3.50 W (+5%, scx housekeeping prevents deepest idle)
2c @ 25% 3.70 -> 3.56 W (-4%)
4c @ 50% 4.87 -> 4.06 W (-17%, core compaction at partial load)
8c @ 100% 6.02 -> 5.89 W (~tie)

Net: large interactivity/latency win; meaningful power savings across the active partial-load range (peak ~17% at moderate load), small idle penalty.

NOTE: tests were run on a CPU without a heatsink. Sustained and high-load figures (esp. 8c@100%) may be influenced by thermal throttling and should be treated as indicative rather than absolute; the relative scheduler comparison holds since both modes were tested under identical conditions.

Downside: shows deprecation warnings on start, should be resolved in next version

[   13.989800] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   13.989811] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   14.949192] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   14.949210] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   14.953290] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   14.964833] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   14.966190] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   15.566527] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   15.635733] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.420296] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.421254] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.425207] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.426421] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.437729] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.438755] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.439759] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.440735] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.441694] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.488458] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.489390] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.501867] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.502901] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.504154] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.548835] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.550813] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.562714] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.563784] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.564993] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.883569] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.884404] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.895400] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.896430] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.897677] sched_ext: Writing directly to p->scx.slice/dsq_vtime is deprecated, use scx_bpf_task_set_slice/dsq_vtime()
[   17.956087] NOTICE: Automounting of tracing to debugfs is deprecated and will be removed in 2030
[   17.961665] ops->cpu_acquire/release() are deprecated, use sched_switch TP instea

Kernel (configs/minconfig-mainline):
  - CONFIG_SCHED_CLASS_EXT=y (sched_ext)
  - CONFIG_DEBUG_INFO_BTF=y, CONFIG_DEBUG_INFO_REDUCED off
    (BTF is required by SCHED_CLASS_EXT and by the scx BPF programs)
  - CONFIG_FTRACE_SYSCALLS=y (sys_enter_execve tracepoint used by scx_lavd)

Build environment:
  - Add dwarves (pahole) to Dockerfile and README kernel deps; BTF
    generation needs pahole >= 1.22 or olddefconfig silently drops it
  - build-kernel-mainline.sh: fail fast if pahole is missing/too old,
    instead of quietly shipping a BTF-less (sched_ext-less) kernel

Image (scx served from our apt repo):
  - Enable scx.service via multi-user.target.wants overlay symlink

Benchmarks (RK3576, 8-core big.LITTLE, on battery, screen off,
scx_lavd v1.1.1 --autopower vs stock EEVDF):

Latency — schbench -m4 -t8 -r30 (wakeup latency):
  p50     3532 us -> 26 us     (135.85x faster)
  p90    16112 us -> 3988 us   (4.04x faster)
  p99    31776 us -> 7976 us   (3.98x faster)
  p99.9  43200 us -> 18272 us  (2.36x faster)

  Throughput: -23% RPS under full saturation (latency/throughput trade).

Power — average watts at fixed load (long-settle fuel-gauge sampling):
  idle      3.32 -> 3.50 W  (+5%, scx housekeeping prevents deepest idle)
  2c @ 25%  3.70 -> 3.56 W  (-4%)
  4c @ 50%  4.87 -> 4.06 W  (-17%, core compaction at partial load)
  8c @ 100% 6.02 -> 5.89 W  (~tie)

Net: large interactivity/latency win; meaningful power savings across the
active partial-load range (peak ~17% at moderate load), small idle penalty.

NOTE: tests were run on a CPU without a heatsink. Sustained and high-load
figures (esp. 8c@100%) may be influenced by thermal throttling and should
be treated as indicative rather than absolute; the relative scheduler
comparison holds since both modes were tested under identical conditions.
@Yury-MonZon
Yury-MonZon requested a review from a team July 2, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant