kthread_affine_preferred(9)
π NAME π
okay so bestie, welcome to the kthread_affine_preferred(9) page from the Kernel API Manual π
this one is all about defining a kthreadβs preferred affinity β not a hard requirement, just the CPU vibe it would love to run on. β¨
β¨ SYNOPSIS β¨
int kthread_affine_preferred (struct task_struct *p , const struct
cpumask *mask );
π ARGUMENTS π
pβ thread created bykthread_create. π§΅maskβ preferred mask of CPUs (might not be online, must be possible) forpto run on. π₯οΈβ¨
π¦ DESCRIPTION π¦
so this is similar to kthread_bind_mask except that the affinity is not a requirement but rather a preference that can be constrained by CPU isolation or CPU hotplug. literally preference energy, not a lockdown. π«Ά
β οΈ must be called before the first wakeup of the kthread. no cap β timing matters here. β°
Returns 0 if the affinity has been applied. β
π SEE ALSO π
Kernel file ./kernel/kthread.c β plus the whole kthread bestie roster:
kthread_should_stop(9)kthread_should_park(9)kthread_freezable_should_stop(9)kthread_func(9)kthread_data(9)kthread_probe_data(9)kthread_complete_and_exit(9)kthread_create_on_node(9)kthread_bind(9)kthread_create_on_cpu(9)kthread_unpark(9)kthread_park(9)kthread_stop(9)kthread_stop_put(9)kthreads_update_housekeeping(9)kthread_worker_fn(9)kthread_create_worker_on_node(9)kthread_create_worker_on_cpu(9)kthread_queue_work(9)kthread_delayed_work_timer_fn(9)kthread_queue_delayed_work(9)kthread_flush_work(9)kthread_mod_delayed_work(9)kthread_cancel_work_sync(9)kthread_cancel_delayed_work_sync(9)kthread_flush_worker(9)kthread_destroy_worker(9)kthread_use_mm(9)kthread_unuse_mm(9)kthread_associate_blkcg(9)kthread_blkcg(9)
sending you off with the ./kernel source/version stamp and the October 2026 date β xoxo, kthread_affine_preferred(9) ππ
π¦ 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