drm_gpusvm_range_chunk_size(9)
π drm_gpusvm_range_chunk_size(9) β the Kernel API Manual page you didn't know you needed
okay so bestie, this is a page straight out of the Kernel API Manual, and it's about one little function that's lowkey doing the math so your GPU shared-virtual-memory range gets chopped into sensible chunks. it's giving "quietly carrying the whole team" energy. let's get into it π«Ά
β¨ NAME β¨
drm_gpusvm_range_chunk_size β literally just: figure out the chunk size for a GPU SVM range π
πΈ SYNOPSIS πΈ
unsigned long drm_gpusvm_range_chunk_size (struct drm_gpusvm *gpusvm ,
struct drm_gpusvm_notifier *notifier , struct vm_area_struct *vas ,
unsigned long fault_addr , unsigned long gpuva_start , unsigned long
gpuva_end , unsigned long check_pages_threshold , void
*dev_private_owner );
π¦ ARGUMENTS π¦
gpusvmβ pointer to the GPU SVM structure. the main character, the one holding everything together πnotifierβ pointer to the GPU SVM notifier structure. it's the one that keeps you posted πvasβ pointer to the virtual memory area structure. thevm_area_struct, your classic VMA bestie.fault_addrβ the fault address. yes, that address, the one everything just got triggered over πgpuva_startβ start address of the GPUVA which mirrors CPU. the beginning of the mirror era πͺgpuva_endβ end address of the GPUVA which mirrors CPU. where the mirroring stops, periodt.check_pages_thresholdβ the threshold for checking CPU pages for present. it's the vibe check, but for pages πdev_private_ownerβ the device private page owner. the one who actually owns the private pages, no cap.
π DESCRIPTION π
so this function figures out the chunk size for the GPU SVM range. and honestly? it's not out here guessing β it's reading the room. it looks at the fault address, the GPU SVM chunk sizes, the GPU SVM ranges that already exist, and the virtual memory area boundaries, and then it picks a size. ate and left no crumbs π₯
β RETURN β
chunk size on success. LONG_MAX on failure π β so if you get LONG_MAX back, that's not a flex, that's a failure, bestie.
π SEE ALSO π
the kernel file ./drivers/gpu/drm/drm_gpusvm.c and honestly the whole friend group:
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_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_destroy(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)
ok that's the whole page π every flag, every pointer, every (9). nothing skipped, nothing summarised. you're welcome π«Ά
mwah π this gem lives in ./drivers/gpu/drm, dated October 2026, and it's filed under drm_gpusvm_range_chunk_size(9). go off, 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