bio_kmalloc(9)
π bio_kmalloc(9) β from the Kernel API Manual, bestie π
okay so picture this: it's a kernel manual page, it lives in ./block, it's dated October 2026, and its whole entire name is bio_kmalloc(9). yes that's the title AND the manual name, we're keeping both, slay. now let's get into it β¨
πΈ NAME πΈ
bio_kmalloc β literally just kmalloc'ing a bio. that's it. that's the vibe. π
π¦ SYNOPSIS π¦
struct bio * bio_kmalloc (unsigned short nr_vecs , gfp_t gfp_mask );
β¨ ARGUMENTS β¨
nr_vecsβ the number ofbio_vecsyou want to allocate, bestie. count 'em.gfp_maskβ theGFP_*mask that gets handed off to the slab allocator. iykyk π
π DESCRIPTION π
so the whole thing here is you use kmalloc to allocate a bio β and yes, that includes the bvecs, they come along for the ride π«Ά
the bio must be initialized using bio_init before you use it. no skipping steps, no cap.
to free a bio that came back from this function, you use kfree after calling bio_uninit. in that order. π
and good news β a bio returned from this function can totally be reused: just call bio_uninit before calling bio_init again. recycling is main character energy β»οΈβ¨
π okay important part, listen up: unlikebio_allocorbio_alloc_bioset, allocations from this function are not backed by a mempool and can fail. and because of that: do not use this function for allocations in the file system I/O path. fr fr, don't do it.
π RETURN π
a pointer to the shiny new bio on success π β or NULL on failure π.
π§ SEE ALSO π§
kernel file ./block/bio.c and honestly a whole friend group of functions, all of them:
bio_reset(9)bio_reuse(9)bio_chain(9)bio_chain_and_submit(9)bio_alloc_bioset(9)bio_truncate(9)guard_bio_eod(9)bio_put(9)bio_alloc_clone(9)bio_init_clone(9)bio_full(9)__bio_add_page(9)bio_add_virt_nofail(9)bio_add_page(9)bio_add_folio(9)bio_add_vmalloc_chunk(9)bio_add_vmalloc(9)bio_iov_iter_get_pages(9)bio_iov_iter_bounce(9)bio_iov_iter_unbounce(9)bio_await(9)submit_bio_wait(9)bdev_rw_virt(9)bio_copy_data(9)bio_endio(9)bio_split(9)bio_trim(9)bioset_init(9)
β and that's the page!! sign-off time: this little icon came from ./block, dated October 2026, and it answers to the name bio_kmalloc(9) π go forth and allocate 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