drm_gpusvm_range_chunk_size(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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. the vm_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:


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