drm_gpusvm_range_destroy(9)
π drm_gpusvm_range_destroy β from the Kernel API Manual, bestie
okay so bestie, welcome to drm_gpusvm_range_destroy(9) π this is the little page that tells you how a GPU SVM range gets yeeted into the void when nobody's holding onto it anymore. it's short, it's sweet, it's iconic. let's go β¨
πΈ NAME πΈ
drm_gpusvm_range_destroy β Destroy GPU SVM range π«Ά
literally what it says on the tin: it destroys the GPU SVM range.
π SYNOPSIS π
void drm_gpusvm_range_destroy (struct kref *refcount );
that's the whole signature, no cap. one argument, returns void, does the thing π
π¦ ARGUMENTS π¦
refcountβ pointer to the reference counter that's embedded inside the GPU SVM range itself π so yeah, the refcount lives in the range, and you're handing us a pointer to it. that's the whole vibe.
β¨ DESCRIPTION β¨
so here's the tea π this function destroys the specified GPU SVM range when its reference count reaches zero β like, that's the trigger, that's the moment, that's the main character energy.
and then there's a fork in the road:
- if a custom range-free function is provided, it gets invoked to free the range π§
- otherwise, the range is deallocated using
kfreeπ
so either your custom free function handles the cleanup and slays, or the kernel just hits it with a plain old kfree. both valid, both fine, just depends on what was set up π
fr fr, the "reaches zero" part matters β this is a reference-counted teardown, not a "call it whenever" situation π
π SEE ALSO π
okay this is the part where the page just dumps the whole friend group on you π and we do not skip a single one, because every single one of them is linked and we keep every detail. so, in the order the page gave them:
- Kernel file
./drivers/gpu/drm/drm_gpusvm.c Overview(9)Locking(9)Partial Unmapping of Ranges(9)Examples(9)npages_in_range(9)drm_gpusvm_notifier_find(9)drm_gpusvm_range_find(9)drm_gpusvm_notifier_invalidate(9)drm_gpusvm_init(9)to_drm_gpusvm_notifier(9)drm_gpusvm_notifier_insert(9)drm_gpusvm_notifier_remove(9)drm_gpusvm_fini(9)drm_gpusvm_notifier_alloc(9)drm_gpusvm_notifier_free(9)to_drm_gpusvm_range(9)drm_gpusvm_range_insert(9)__drm_gpusvm_range_remove(9)drm_gpusvm_range_alloc(9)drm_gpusvm_hmm_pfn_to_order(9)drm_gpusvm_check_pages(9)drm_gpusvm_scan_mm(9)drm_gpusvm_range_chunk_size(9)drm_gpusvm_driver_lock_held(9)drm_gpusvm_find_vma_start(9)drm_gpusvm_range_find_or_insert(9)__drm_gpusvm_unmap_pages(9)__drm_gpusvm_free_pages(9)drm_gpusvm_free_pages(9)drm_gpusvm_range_remove(9)drm_gpusvm_range_get(9)drm_gpusvm_range_put(9)drm_gpusvm_pages_valid(9)drm_gpusvm_pages_valid_unlocked(9)drm_gpusvm_get_pages(9)drm_gpusvm_unmap_pages(9)drm_gpusvm_range_evict(9)drm_gpusvm_has_mapping(9)drm_gpusvm_range_set_unmapped(9)
like, that's the whole squad π«Ά go read them, they're all right there, iykyk.
that's the page!! short, useful, and honestly kind of a banger π
and for the cute sign-off: this one lives under ./drivers/gpu/drm πΈ, it's from October 2026, and it's filed as drm_gpusvm_range_destroy(9) π go destroy some ranges responsibly, bestie πβ¨
π¦ 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