kthread_associate_blkcg(9)
π kthread_associate_blkcg π
okay so bestie, welcome to the Kernel API Manual β this is a kthread page and it's genuinely such a serve, let me tell you everything π«Ά
β¨ NAME β¨
kthread_associate_blkcg β associate blkcg to current kthread π
like, it's the little function that lets a kernel thread carry someone else's cgroup info around. iconic behavior, no cap.
πΈ SYNOPSIS πΈ
void kthread_associate_blkcg (struct cgroup_subsys_state *css );
literally one line, one argument, void return β she's lowkey minimal and I respect it π
π¦ ARGUMENTS π¦
cssβ the cgroup info π like, that's it, that's the whole thing. it's the cgroup info you're handing over.
π DESCRIPTION π
okay so here's the vibe check: the current thread must be a kthread. periodt. not optional, not a suggestion, it's literally the requirement π
The thread is running jobs on behalf of other threads β think of it as the friend who does the group project for everyone π and in some cases, we expect the jobs to attach the cgroup info of the original threads instead of that of the current thread.
So what does this function actually do? It stores the original thread's cgroup info in the current kthread context for later retrieval. π¦β¨ That's the whole flex. Stash it now, grab it later. iykyk.
fr fr though β current thread must be a kthread, that's the one thing to remember π
β SEE ALSO β
the whole friend group shows up for this one, they all ate π₯
- Kernel file
./kernel/kthread.cπ§ and also: 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_node(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_blkcg(9)
and that's the whole page bestie π slay π
this masterpiece lives under ./kernel in the Kernel API Manual, dated October 2026 β go off, and remember: current thread must be a kthread πβ¨
π¦ 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