kthread_affine_preferred(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 by kthread_create. 🧡
  • mask β€” preferred mask of CPUs (might not be online, must be possible) for p to 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:


sending you off with the ./kernel source/version stamp and the October 2026 date β€” xoxo, kthread_affine_preferred(9) πŸŽ€πŸ’–

πŸ“¦ where this page comes from