blkg_lookup_create(9)
π blkg_lookup_create(9) β the Kernel API Manual, but make it cute π
okay bestie, so this is a page from the Kernel API Manual and it's literally all about blkg_lookup_create β¨ like, it's giving "find-or-make" energy and i'm obsessed. let's get into it π«Ά
β¨ NAME β¨
blkg_lookup_create β lookup a blkg, and lowkey try to create one if it's not there π
πΈ SYNOPSIS πΈ
struct blkcg_gq * blkg_lookup_create (struct blkcg *blkcg , struct gendisk *disk );
π¦ ARGUMENTS π¦
blkcgβ the blkcg of interest, aka the one we're looking at πdiskβ the gendisk of interest, bestie π«Ά
π DESCRIPTION π
so here's the vibe: this function looks up the blkg for the blkcg - disk pair. iconic pairing tbh. if it doesn't exist? no worries, it tries to create one β¨
and not me about to explain the recursion β blkg creation is performed recursively from blkcg_root, so that all non-root blkg's have access to the parent blkg. it's giving family tree, it's giving main character energy π§
β οΈ okay important caveat bestie: this function should be called under RCU read lock and it takes disk->queue->queue_lock. don't forget, i'm serious π
and the return? it returns the blkg, or the closest blkg if blkg_create fails as it walks down from root. so like, it still gives you something, which is nice of it fr fr π
π SEE ALSO π
kernel file ./block/blk-cgroup.c and literally the whole friend group:
blkcg_css(9)blkg_free(9)bio_blkcg_css(9)blkcg_parent(9)blkg_alloc(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_from_css(9)bio_associate_blkg(9)bio_clone_blkg_association(9)
and that's the whole page bestie, no cap π§’ this cutie lives in ./block and the version is Kernel API Manual, dated October 2026 β periodt, we ate and left no crumbs π
β¨π
π¦ 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