__devm_alloc_percpu(9)
β¨ __devm_alloc_percpu(9) β¨
okay so bestie, welcome to the kernel API manual page for __devm_alloc_percpu π
this one lives in the Linux kernel docs and honestly? it's giving "tiny function, huge glow-up energy" π
πΈ NAME πΈ
__devm_alloc_percpu β resource-managed alloc_percpu π«Ά
like, the alloc_percpu you already know and love, but with the devres babysitter attached β¨
π¦ SYNOPSIS π¦
void __percpu * __devm_alloc_percpu (struct device *dev , size_t size ,
size_t align );
π ARGUMENTS π
devβ the device you're allocating this per-cpu memory for π like, whose devres list is this gonna live on? that one.sizeβ the size of the per-cpu memory you wanna allocate πalignβ the alignment of the per-cpu memory you wanna allocate π yes bestie, alignment matters, don't skip it
β DESCRIPTION β
so it's a managed alloc_percpu π« and the whole slay of it is this: per-cpu memory allocated with this function is automatically freed on driver detach π₯ no manual cleanup, no "oops I forgot to free it", no leak drama. the devres machinery handles it for you, periodt.
lowkey the most iconic thing about the devm family: you allocate, the driver detaches, it's gone. no cap π
π RETURN π
- pointer to the allocated memory on success π
NULLon failure π (check it, bestie, always check it)
π§ SEE ALSO π§
kernel file ./drivers/base/devres.c β and the whole devres friend group, fr fr:
__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(9)devm_kmemdup_const(9)devm_get_free_pages(9)devm_free_pages(9)
okay but seriously bestie, if you're poking around in ./drivers/base then that list above is your reading list π go be nosy, it's all connected iykyk
and that's the whole page, mwah π this lil guy is courtesy of the ./drivers/base section of the kernel docs, dated October 2026, and the page is literally titled __devm_alloc_percpu(9) β so next time you see that header floating around, you'll know exactly whose vibe it is πβ¨π
π¦ 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