kthread_create_on_cpu(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kthread_create_on_cpu(9) β€” from the Kernel API Manual, bestie

okay so this is kthread_create_on_cpu(9), straight out of the Kernel API Manual, and it's literally the glow-up helper for making a cpu bound kthread. like, binding a thread to one specific cpu? iconic. let's get into it πŸŽ€


✨ NAME ✨

kthread_create_on_cpu β€” Create a cpu bound kthread 🌸


✨ SYNOPSIS ✨

struct task_struct * kthread_create_on_cpu (int (*threadfn)(void *data)
, void *data , unsigned int cpu , const char *namefmt );

it returns a struct task_struct *, no cap πŸ’–


✨ ARGUMENTS ✨

  • threadfn β€” the function that's gonna run, and it keeps running until signal_pending(current). that's the whole vibe, she goes until she's told to stop 🫢
  • data β€” the data ptr you're handing off to threadfn. her little care package πŸ’œ
  • cpu β€” the cpu where the thread should be bound. yes bestie, that one, specifically πŸ‘‘
  • namefmt β€” printf-style name for the thread. and here's the catch: format is restricted to "name.*u". the code fills in the cpu number itself. so don't get creative with it πŸ’…

✨ DESCRIPTION ✨

so literally what this does: this helper function creates and names a kernel thread. that's it. that's the whole thing. create ✨ and name ✨ and it's cpu bound because that's the whole point of the helper, see the cpu argument πŸ”₯

ngl that's the entire description, short and sweet, main character energy fr fr πŸ’€


✨ SEE ALSO ✨

kernel file ./kernel/kthread.c β€” and the whole kthread extended universe, besties 🌈:


okay that's the whole page, go read the source at ./kernel and remember: this beauty is dated October 2026, iykyk πŸ¦‹πŸ’– slay responsibly 🧚✨

πŸ“¦ where this page comes from