devm_kmemdup(9)
bestie, this is devm_kmemdup(9) from the Kernel API Manual, and it's literally the resource-managed glow-up of kmemdup π
β¨ NAME β¨
devm_kmemdup β resource-managed kmemdup (yes, the memory cleans up after itself, main character energy fr fr)
β¨ SYNOPSIS β¨
void * devm_kmemdup (struct device *dev , const void *src , size_t len ,
gfp_t gfp );
β¨ ARGUMENTS β¨
devβ the device this memory belongs to π«Ά (it's giving "this allocation is on your tab")srcβ the memory region you wanna duplicate πΈlenβ how long that memory region is, bestie πgfpβ the GFP mask to use β¨
β¨ DESCRIPTION β¨
Okay so what it does is duplicate a region of memory using resource-managed kmalloc π. That's the whole vibe β it's kmemdup but with the devres magic so the memory is tracked against dev. Iconic behavior honestly.
β¨ SEE ALSO β¨
lowkey the whole devres friend group is here, no cap π«Ά β kernel file ./drivers/base/devres.c plus:
__devres_alloc_node(9)devres_for_each_res(9)devres_free(9)devres_add(9)devres_find(9)devres_get(9)devres_remove(9)devres_destroy(9)devres_release(9)devres_release_all(9)devres_open_group(9)devres_close_group(9)devres_remove_group(9)devres_release_group(9)__devm_add_action(9)devm_remove_action_nowarn(9)devm_release_action(9)devm_kmalloc(9)devm_krealloc(9)devm_kstrdup(9)devm_kstrdup_const(9)devm_kvasprintf(9)devm_kasprintf(9)devm_kfree(9)devm_kmemdup_const(9)devm_get_free_pages(9)devm_free_pages(9)__devm_alloc_percpu(9)
and that's the whole page, bestie β source <pink>./drivers/base</pink>, dated October 2026, page devm_kmemdup(9). go forth and duplicate responsibly πβ¨
π¦ 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