set_cpus_allowed_ptr(9)
π set_cpus_allowed_ptr β kernel API manual, but make it cute
okay so bestie, we're in the Kernel API Manual today and the star of the show is set_cpus_allowed_ptr β¨ literally the function that sets the CPU affinity mask of a task. that's it, that's the vibe. icl it's giving "i decide which CPUs you get to hang out with" π
π NAME π
set_cpus_allowed_ptr β set CPU affinity mask of a task π§
like, it picks which CPU(s) a task is allowed to run on. main character energy for the task, honestly.
β¨ SYNOPSIS β¨
int set_cpus_allowed_ptr (struct task_struct *p , const struct cpumask
*new_mask );
no cap, that's the whole signature β copy it exactly, don't come for me π
π¦ ARGUMENTS π¦
pβ the task π like, the actual task you're doing this tonew_maskβ CPU affinity mask πΈ the shiny new set of CPUs you're handing over
π RETURN π
returns zero if it all went slay β
or a negative error code if it did not π (iykyk, negative error codes are never the vibe)
π SEE ALSO π
- kernel file
./include/linux/sched.h - struct
prev_cputime(9) __task_lazy_mmu_mode_active(9)is_lazy_mmu_mode_active(9)task_nice(9)is_idle_task(9)
go read those too fr fr, they're all in the group chat ππ«Ά
ok tiny reminder bestie: zero means success, negative means error β don't flip it, that's not the assignment π
and that's the whole page, periodt π
this one lives in ./include/linux (source ./include/linux) and it's dated October 2026 β so yes she's from the future, and she ate ππ bye bestie, mwah π«Άπ
π¦ 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