STRUCT DMA_RESV(9)
β¨ struct dma_resv(9) β¨
okay so bestie, welcome to the kernel api manual π
today's main character is struct dma_resv β the reservation object that manages fences for a buffer. yes, fences. no, not the wooden kind π
πΈ SYNOPSIS πΈ
fr fr, here's the whole vibe, character for character:
struct dma_resv {
struct ww_mutex lock;
struct dma_resv_list *fences;
};
π Members π
lockβ the update side lock. like, do not use it directly, bestie π please use the wrapper functions instead, likedma_resv_lockanddma_resv_unlock. that's the whole point.
drivers that use the reservation object to manage memory dynamically also use this lock to protect buffer object state β think placement, allocation policies, or throughout command submission. it's giving multitasking queen β¨
fencesβ the array of fences which where added to thedma_resvobject. (yes, "where". we don't fix the original's grammar, we respect it π«Ά)
a new fence gets added by calling dma_resv_add_fence. and the way that this often needs to happen past the point of no return in command submission means it literally cannot fail π₯ so you need to reserve sufficient slots ahead of time by calling dma_resv_reserve_fences. plan ahead, babe. no cap.
π Description π
this is a container for dma_fence objects which needs to handle multiple use cases. a container! for multiple things! versatility icon π¦
one use is to synchronize cross-driver access to a struct dma_buf β either for dynamic buffer management, or just to handle implicit synchronization between different users of the buffer in userspace. see dma_buf.resv for a more in-depth discussion, iykyk π
the other major use is managing access and locking within a driver in a buffer based memory manager. struct ttm_buffer_object is the canonical example here, since this is where reservation objects originated from π but use in drivers is spreading, and some drivers also manage struct drm_gem_object with the same scheme. growth era fr fr π
π SEE ALSO π
kernel file ./include/linux/dma-resv.h β go read it, bestie, it's iconic:
enum dma_resv_usage(9)dma_resv_usage_rw(9)struct dma_resv_iter(9)dma_resv_iter_begin(9)dma_resv_iter_end(9)dma_resv_iter_usage(9)dma_resv_iter_is_restarted(9)dma_resv_for_each_fence_unlocked(9)dma_resv_for_each_fence(9)dma_resv_lock(9)dma_resv_lock_interruptible(9)dma_resv_lock_slow(9)dma_resv_lock_slow_interruptible(9)dma_resv_trylock(9)dma_resv_is_locked(9)dma_resv_locking_ctx(9)dma_resv_unlock(9)
and that's the page, bestie π«Ά this one lives in ./include/linux, dated October 2026, and it's filed under struct dma_resv(9). slay, go forth and fence 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