kthread_run(9)
π« 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 untilsignal_pending(current)says "okay queen, that's enough" π it's the actual work-doer, the whole point of the threaddataβ the data ptr you hand off tothreadfn. it's giving "here's your little bag of stuff, go wild" πnamefmtβ aprintf-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 thatnamefmtπ
π₯ 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, meaningkthread_create+wake_up_processare doing the actual lifting underneath.kthread_runjust makes it one line and keeps your code looking cute π§
π SEE ALSO π
- Kernel file
./include/linux/kthread.h kthread_create(9)kthread_run_on_cpu(9)kthread_run_worker(9)kthread_run_worker_on_cpu(9)
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
- 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