svm_range_evict(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… svm_range_evict β€” like, the eviction queen of the kernel API manual ✨

okay so bestie, this is svm_range_evict from the Kernel API Manual, and honestly it's giving "kick everyone out of the pool so the cleaners can work" energy. let me tell you everything, no cap 🫢


✨ NAME ✨

svm_range_evict β€” literally evicts an svm range πŸ’– that's it, that's the whole vibe


πŸ¦‹ SYNOPSIS πŸ¦‹

int svm_range_evict (struct svm_range *prange , struct mm_struct *mm ,
unsigned long start , unsigned long last , enum mmu_notifier_event event
);

she takes five args and returns an int, periodt πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • prange β€” the svm range structure, bestie. this is the main character of the whole function 🌸
  • mm β€” the current process mm_struct. yep, the memory map of whoever's running rn 🧚
  • start β€” the starting process queue number ✨
  • last β€” the last process queue number πŸ’œ
  • event β€” the mmu notifier event, fired when the range gets evicted or migrated. very "something happened, pay attention" of it πŸ™ˆ

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's the tea: first thing she does is stop all the queues of the process β€” like, every single one β€” so the GPU literally cannot touch that memory. safety first, always πŸ”’βœ¨ then she returns and lets the CPU evict the buffer and go ahead with the CPU pagetable update. slay.

and here's the iconic part: you don't need to use a lock to sync cpu pagetable invalidation with GPU execution. no cap, not needed 🫢

but wait, what if invalidation happens while restore work is running? 😭 don't stress β€” the restore work will just restart to make sure it gets the latest CPU pages mapped to the GPU, and then it starts the queues back up. she ate and left no crumbs πŸ‘‘


🌈 SEE ALSO 🌈

kernel file ./drivers/gpu/drm/amd/amdkfd/kfd_svm.c plus the whole squad:

go read them, iykyk πŸ’–


and that's the whole page bestie!! πŸŽ€ this iconic lil manual page lives over in ./drivers/gpu/drm/amd/amdkfd and it's dated October 2026 β€” a whole future vibe, we love to see it β­πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from