bio_associate_blkg_from_css(9)
π bio_associate_blkg_from_css π (that's the 9 kernel API manual, bestie, we're in the kernel section)
Ok so picture this: you've got a bio (a block I/O request, the main character) and you've got a css (a cgroup subsystem state, its emotional support), and you need them to be, like, linked. This is the function that does the linking. Periodt.
β¨ NAME β¨
bio_associate_blkg_from_css β associate a bio with a specified css π«Ά
πΈ SYNOPSIS πΈ
void bio_associate_blkg_from_css (struct bio *bio , struct
cgroup_subsys_state *css );
No return value, it just does the thing. Void. Iconic behavior honestly π
π ARGUMENTS π
bioβ the target bio π― like, this is the one getting associatedcssβ the target css π― the thing it's getting associated with
π¦ DESCRIPTION π¦
Okay so here's the vibe: this function associates bio with the blkg it finds by combining the css's blkg and the request_queue of the bio. Two ingredients, one blkg, slay π§
Now β and this is the important part, don't skip it β if the association fails, that's handled by walking up the blkg tree π³. Which means the blkg you end up associated with can be, like, anything between blkg and q->root_blkg. Not a bug, that's just how it goes.
When does that even happen? Only when a cgroup is dying π and then the remaining bios will spill over to the closest alive blkg. Rip to the dying cgroup but those bios are built different, they find a way π
Also! A reference will be taken on the blkg, and it'll be released when bio is freed π₯ So like, the bookkeeping is handled, you don't gotta worry about it. No cap.
π SEE ALSO π
Kernel file ./block/blk-cgroup.c β go read it, it's giving source of truth π
blkcg_css(9)blkg_free(9)bio_blkcg_css(9)blkcg_parent(9)blkg_alloc(9)blkg_lookup_create(9)blkcg_print_blkgs(9)__blkg_prfill_u64(9)blkg_conf_init(9)blkg_conf_open_bdev(9)blkg_conf_prep(9)blkg_conf_unprep(9)blkg_conf_close_bdev(9)blkcg_destroy_blkgs(9)blkcg_pin_online(9)blkcg_unpin_online(9)blkcg_css_offline(9)blkcg_activate_policy(9)blkcg_deactivate_policy(9)blkcg_policy_register(9)blkcg_policy_unregister(9)blkcg_maybe_throttle_current(9)blkcg_schedule_throttle(9)blkcg_add_delay(9)blkg_tryget_closest(9)bio_associate_blkg(9)bio_clone_blkg_association(9)
π‘ friendly reminder bestie: every single one of those above is a real page, go click around, iykyk
And that's the whole page! Source <pink>./block</pink>, dated <purple>October 2026</purple>, and yes the whole thing is filed under <hotpink>bio_associate_blkg_from_css(9)</hotpink> π Go be a kernel girlie, you got this π«Άβ¨π
π¦ 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