Open
Description
CPU IDs aren't guaranteed to be consecutive. To iterate all possible or currently online CPUs, the respective cpumask should be iterated. There are several issues in this area:
- Some are iterating 0 to the number of online CPUS. This is incorrect as CPU IDs can have gaps and thus can miss higher numbered CPUs.
- Some are iterating 0 to
nr_cpu_ids
. This is correct but not ideal in that the CPU IDs can have substantial gaps not online or unallocated. - The possible and online cpumasks can be accessed from BPF side using
scx_bpf_get_possible_cpumask()
andscx_bpf_get_online_cpumask()
, respectively. However,scx_utils::toplogy
doesn't expose the current possible or online CPU masks that are available through/sys/devices/system/cpu/possible
andonline
.
Make scx_utils::topology
expose the cpumasks and make all schedulers use the appropriate cpumask for iteration in both userspace and BPF code.