scx_bpf_select_cpu_dfl(9)
π scx_bpf_select_cpu_dfl(9) β like, the default CPU picker, bestie
okay so this is a Kernel API Manual page, section 9 (kernel API, iykyk), and it's about scx_bpf_select_cpu_dfl β literally the built-in, off-the-shelf version of ops.select_cpu(). if you're writing an sched_ext scheduler and you don't wanna hand-roll your own CPU picking logic, this is your girl π
β¨ NAME β¨
scx_bpf_select_cpu_dfl β the default implementation of ops.select_cpu(), no cap π«Ά
β¨ SYNOPSIS β¨
__bpf_kfunc s32 scx_bpf_select_cpu_dfl (struct task_struct *p , s32
prev_cpu , u64 wake_flags , bool *is_idle , const struct bpf_prog_aux
*aux );
β¨ ARGUMENTS β¨
pβ thetask_structyou're picking a CPU for. the main character, honestly πprev_cpuβ the CPU thatpwas hanging out on before. its last known location πΊοΈwake_flagsβ theSCX_WAKE_*flags. the vibe check for the wakeup πΈis_idleβ an out parameter, bestie. it tells you whether the CPU that got returned is idle β so like, is it a good candidate for direct dispatching or not π€auxβ an implicit BPF argument used to accessbpf_prog_aux, and it's hidden from BPF progs π don't worry about it, it's not for you
β¨ DESCRIPTION β¨
so basically you can call this from ops.select_cpu, from ops.enqueue, or even from an unlocked context like a BPF test_run call β as long as built-in CPU selection is enabled. and "enabled" here means: ops.update_idle is missing, or SCX_OPS_KEEP_BUILTIN_IDLE is set. one of those two, periodt β¨
it returns the picked CPU, and *is_idle tells you whether that picked CPU is currently idle β which lowkey makes it a great candidate for direct dispatching π₯
β¨ SEE ALSO β¨
kernel file ./kernel/sched/ext/idle.c, plus the whole friend group π«Ά:
scx_bpf_cpu_node(9)__scx_bpf_select_cpu_and(9)scx_bpf_get_idle_cpumask_node(9)scx_bpf_get_idle_cpumask(9)scx_bpf_get_idle_smtmask_node(9)scx_bpf_get_idle_smtmask(9)scx_bpf_put_idle_cpumask(9)scx_bpf_test_and_clear_cpu_idle(9)scx_bpf_pick_idle_cpu_node(9)scx_bpf_pick_idle_cpu(9)scx_bpf_pick_any_cpu_node(9)scx_bpf_pick_any_cpu(9)
anyway that's the whole page, mwah π this one came from ./kernel/sched/ext and it's dated October 2026 β go pick some CPUs, bestie, you got this π¦π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms