kthread_run(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« kthread_run πŸ’«

okay bestie, welcome to the Kernel API Manual entry for kthread_run β€” yes, that one, the glow-up wrapper you've been looking for πŸŽ€


✨ NAME ✨

kthread_run β€” literally creates a thread AND wakes it up. two jobs, one function, main character energy fr πŸ’…


🌸 SYNOPSIS 🌸

kthread_run (threadfn , data , namefmt , ... );

that's it. that's the whole vibe. copy it exactly, no cap 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • threadfn β€” the function that keeps running until signal_pending(current) says "okay queen, that's enough" 😭 it's the actual work-doer, the whole point of the thread
  • data β€” the data ptr you hand off to threadfn. it's giving "here's your little bag of stuff, go wild" πŸ“
  • namefmt β€” a printf-style name for the thread. yes, printf-style, so format specifiers go crazy here ✨ name your thread something cute, it's allowed
  • ... β€” variable arguments. the little extras that feed into that namefmt πŸ‘‘

πŸ”₯ DESCRIPTION πŸ”₯

okay so listen πŸ‘ kthread_run is a convenient wrapper for kthread_create followed by wake_up_process. that's the entire lore. create the thread, then wake it up, all in one tidy little call β€” the way that it does both steps for you is honestly iconic πŸ’–

what does it give back? it returns the kthread, or β€” and this is the part where you go πŸ’€ β€” ERR_PTR(-ENOMEM). so like, check your return value, bestie. no cap. always check it. an ERR_PTR is not a real thread and you will have a bad time πŸ™ˆ

so real talk: this is a wrapper, meaning kthread_create + wake_up_process are doing the actual lifting underneath. kthread_run just makes it one line and keeps your code looking cute 🧚

🌈 SEE ALSO 🌈

go read the whole family, they're all lowkey obsessed with each other πŸ¦‹βœ¨


and that's the page!! mwah πŸ’‹ sign-off time: this lil masterpiece lives in ./include/linux and the kthread_run(9) manual page is dated October 2026 β€” so like, go forth and thread responsibly, bestie πŸŽ€πŸ’œβ­

πŸ“¦ where this page comes from