MANAGED RESOURCES(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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

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