KFunc scx_bpf_pick_any_cpu
Pick and claim an idle CPU if available or pick any CPU
Definition
Pick and claim an idle CPU in cpus_allowed. If none is available, pick any CPU in cpus_allowed. Guaranteed to succeed.
If sched_ext_ops.update_idle is implemented and SCX_OPS_KEEP_BUILTIN_IDLE is not set, this function can't tell which CPUs are idle and will always pick any CPU.
Always returns an error if SCX_OPS_BUILTIN_IDLE_PER_NODE is set, use scx_bpf_pick_idle_cpu_node instead.
Parameters
cpus_allowed: Allowed cpumask
flags: SCX_PICK_IDLE_* flags
Flags
SCX_PICK_IDLE_CORE- pick a CPU whose SMT siblings are also idle
Returns
The picked idle CPU number if cpus_allowed is not empty. -EBUSY is returned if cpus_allowed is empty.
Signature
s32 scx_bpf_pick_any_cpu(const struct cpumask *cpus_allowed, u64 flags)
Usage
Docs could be improved
This part of the docs is incomplete, contributions are very welcome
Program types
The following program types can make use of this kfunc:
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome