MANAGED RESOURCES(9)
okay bestie, welcome to the managed resources(9) page from the Kernel API Manual π this one is short but it's literally carrying lifetime lore, so let's go.
πΈ managed resources β¨
These are inspired by struct device managed resources, but plot twist: they're tied to the lifetime of struct drm_device. And struct drm_device can outlive the underlying physical device β usually when userspace has some open files and other handles to resources still open. Main character energy, fr fr π
Release actions can be added with drmm_add_action, and memory allocations can be done directly with drmm_kmalloc and the related functions. Everything will be released on the final drm_dev_put in reverse order of how the release actions have been added and memory has been allocated since driver loading started with devm_drm_dev_alloc. No cap β¨
Note that release actions and managed memory can also be added and removed during the lifetime of the driver β all the functions are fully concurrent safe. But it is recommended to use managed resources only for resources that change rarely, if ever, during the lifetime of the drm_device instance. That's the vibe check, bestie π«Ά
π SEE ALSO
- Kernel file
./drivers/gpu/drm/drm_managed.c drmm_release_action(9)drmm_kmalloc(9)drmm_kstrdup(9)drmm_kfree(9)
xoxo, this page is sourced from ./drivers/gpu/drm, dated October 2026, and it's the managed resources(9) page from the Kernel API Manual β periodt ππ¦π
π¦ 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