kthread_cre...rker_on_node(9)
πΈ kthread_create_worker_on_node(9) πΈ
okay bestie, so this is the kernel API manual page for kthread_cre...rker_on_node(9) β yes the header/footer truncate it like that, that's just how it vibes in the index, don't come for me π
. It's a section 9 kernel page, so buckle up buttercup.
β¨ NAME β¨
kthread_create_worker_on_node β literally just: create a kthread worker. that's the whole thing. iconic brevity. π
π¦ SYNOPSIS π¦
struct kthread_worker * kthread_create_worker_on_node (unsigned int
flags , int node , const char namefmt[] , ... );
like, it hands you back a struct kthread_worker * β she's a pointer, she's allocated, she's ready π«Ά
π ARGUMENTS π
flagsβ the flags that modify the default behavior of the worker. that's it, that's the whole story, no cap.nodeβ the task structure for the thread gets allocated on this node. so like, pick your NUMA node wisely bestie πnamefmtβ aprintf-style name for the kthread worker (task). give her a cute name, she deserves it....β variable arguments. the actual values that go into yournamefmt. you know how printf works, i believe in you π
π₯ DESCRIPTION π₯
so what does it actually return?? glad you asked, this is important π
- On success β a pointer to the allocated worker. slay. β¨
ERR_PTR(-ENOMEM)β when the needed structures could not get allocated. she ran out of memory, it's giving budget cuts πERR_PTR(-EINTR)β when the caller was killed by a fatal signal. RIP to your thread, gone too soon π
fr fr check that return value withIS_ERR()before you dereference anything, okay?? that's not in the page, that's just me caring about you π«Ά (the page says: pointer on success,ERR_PTR(-ENOMEM),ERR_PTR(-EINTR). that's the facts.)
π SEE ALSO π
Kernel file ./kernel/kthread.c, plus literally the entire kthread friend group β she knows everybody:
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)kthread_affine_preferred(9)kthreads_update_housekeeping(9)kthread_worker_fn(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)
okay that's the whole page, go forth and spawn threads responsibly π§π«
sign-off time: this little beauty lives in ./kernel, dated October 2026, and it's filed under kthread_cre...rker_on_node(9) β yeah the footer truncates it too, she's mysterious like that ππ
bye 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