sched-ext/scx

scx_rusty: Fix init failure when only one CPU is left online

Closed this issue · 0 comments

scx_rusty fails to load if there is only one CPU online:

root@test ~# cat /sys/devices/system/cpu/possible
0-15
root@test ~# cat /sys/devices/system/cpu/online
0
root@test ~# os/scx/target/release/scx_rusty --stats 1
21:11:31 [INFO] Running scx_rusty (build ID: 1.0.5-g7402895-dirty x86_64-unknown-linux-gnu)
21:11:31 [INFO] NODE[00] mask= 0001
21:11:31 [INFO]  DOM[00] mask= 0001
21:11:31 [INFO] Rusty scheduler started! Run `scx_rusty --monitor` for metrics.

DEBUG DUMP
================================================================================

scx_rusty[2087] triggered exit kind 1024:
  runtime error (ops.init() failed (-2))

Backtrace:
  bpf_scx_reg+0x544/0xc20
  bpf_struct_ops_link_create+0xf8/0x140
  __sys_bpf+0x348/0x510
  __x64_sys_bpf+0x18/0x20
  do_syscall_64+0x7b/0x140
  entry_SYSCALL_64_after_hwframe+0x76/0x7e

CPU states
----------

CPU 0   : nr_run=0 flags=0x1 cpu_rel=0 ops_qseq=0 pnt_seq=0
          curr=scx_rusty[2087] class=fair_sched_class

================================================================================

Error: EXIT: runtime error (ops.init() failed (-2))

Note that the specific error message may differ as there are some pending kernel changes in the area. However, the error is caused by src/bpf/main.bpf.c::initialize_cpu() failing with -ENOENT.