Skip to content

KFunc scx_bpf_pick_any_cpu

v6.12

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 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.

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