STRUCT DRM_GPUSVM(9)
π struct drm_gpusvm β NAME
okay so, struct drm_gpusvm β literally just the GPU SVM structure, bestie. that's the whole name. that's it. that's the vibe. β¨
This is page struct drm_gpusvm(9) from the Kernel API Manual, and we're gonna get into it.
πΈ SYNOPSIS
struct drm_gpusvm {
const char *name;
struct mm_struct *mm;
unsigned long mm_start;
unsigned long mm_range;
unsigned long notifier_size;
const struct drm_gpusvm_ops *ops;
const unsigned long *chunk_sizes;
int num_chunks;
struct rw_semaphore notifier_lock;
struct rb_root_cached root;
struct list_head notifier_list;
#ifdef CONFIG_LOCKDEP;
struct lockdep_map *lock_dep_map;
#endif;
};
look at her. iconic. no notes. π«Ά
π Members
nameβ the name of the GPU SVM. yeah she has a name, she's that girl πmmβ pointer to themm_structfor the address space. your link to the actual memory map, iykyk πmm_startβ the start address of the GPU SVM. where the party begins πmm_rangeβ the range of the GPU SVM. how far the party goes πnotifier_sizeβ the size of individual notifiers. one size, per notifier, that's it β¨opsβ pointer to the operations structure for GPU SVM. the callback squad, the real MVPs πchunk_sizesβ pointer to the array of chunk sizes used in range allocation. important: entries should be powers of 2 in descending order. not me stressing about the ordering π it's powers of 2, descending, periodt π§num_chunksβ number of chunks. the headcount for your chunk party π¦notifier_lockβ a read-write semaphore for protecting notifier operations. security for the notifiers, no cap π₯rootβ the cached root node of the Red-Black tree containing GPU SVM notifiers. yes, an RB tree, yes it's still serving π³notifier_listβ a list head containing the notifiers in the same order they appear in the interval tree. this is useful to keep iterating notifiers while doing modifications to RB tree. honestly? a lifesaver. you can keep walking the list while the tree is getting rearranged, lowkey genius πlock_dep_mapβ annotatesdrm_gpusvm_range_find_or_insertanddrm_gpusvm_range_removewith a driver provided lock. yes this one's inside the lockdep ifdef, hi<kbd>no wait β it's under#ifdef CONFIG_LOCKDEP;babes π
π« Description
okay so here's the tea: this structure represents a GPU SVM (Shared Virtual Memory) used for tracking memory ranges mapped in a DRM (Direct Rendering Manager) device. πΈ
and this is the important bit, so listen up: no reference counting is provided, as this is expected to be embedded in the driver VM structure along with thestruct drm_gpuvm, which handles reference counting. so don't come for her for not counting refs β that'sdrm_gpuvm's job, and she said what she said π
π SEE ALSO
- Kernel file
./include/drm/drm_gpusvm.h struct drm_gpusvm_ops(9)struct drm_gpusvm_notifier(9)struct drm_gpusvm_pages_flags(9)struct drm_gpusvm_pages(9)struct drm_gpusvm_range_flags(9)struct drm_gpusvm_range(9)struct drm_gpusvm_ctx(9)drm_gpusvm_init_pages(9)enum drm_gpusvm_scan_result(9)drm_gpusvm_driver_set_lock(9)drm_gpusvm_notifier_lock(9)drm_gpusvm_notifier_unlock(9)drm_gpusvm_range_start(9)drm_gpusvm_range_end(9)drm_gpusvm_range_size(9)drm_gpusvm_notifier_start(9)drm_gpusvm_notifier_end(9)drm_gpusvm_notifier_size(9)__drm_gpusvm_range_next(9)drm_gpusvm_for_each_range(9)drm_gpusvm_for_each_range_safe(9)__drm_gpusvm_notifier_next(9)drm_gpusvm_for_each_notifier(9)drm_gpusvm_for_each_notifier_safe(9)
that's the whole page, bestie, you ate it up π β¨
sign-off time: this one lives in ./include/drm, dated October 2026, and it's struct drm_gpusvm(9) β slay, go read the header, mwah πππ¦
π¦ 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