drm_gpusvm_f...h_range_safe(9)
π drm_gpusvm_for_each_range_safe β¨
okay so bestie, welcome to the Kernel API Manual β this one's a macro page, and it's literally the "delete while you loop" bestie you didn't know you needed π«Ά
πΈ NAME πΈ
drm_gpusvm_for_each_range_safe β safely iterate over GPU SVM ranges in a notifier π
Like, the safe version. The one that won't betray you mid-loop π
π SYNOPSIS π
drm_gpusvm_for_each_range_safe (range__ , next__ , notifier__ , start__ , end__ );
five args, all vibes, all required β¨
π¦ ARGUMENTS π¦
range__β your iterator variable for the ranges π she's the main character, she holds the current rangenext__β your iterator variable for the ranges' temporary storage π§ this is the secret second slot so you can keep going after you delete something, iykyknotifier__β pointer to the GPU SVM notifier π« the thing you're looping over, fr frstart__β start address of the range πΈend__β end address of the range π
β DESCRIPTION β
okay so here's the tea π β this macro is used to iterate over GPU SVM ranges in a notifier while removing ranges from it.
that's the whole point. that's the slay. you're walking the list and yeeting entries as you go, and it does not fall apart on you π periodt.
β οΈ note the safe in the name, bestie β that's the one you want when you're mutating the thing you're iterating. don't come crying to me if you use the unsafe one π
π₯ SEE ALSO π₯
Kernel file ./include/drm/drm_gpusvm.h, plus the whole friend group:
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(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_notifier_next(9)drm_gpusvm_for_each_notifier(9)drm_gpusvm_for_each_notifier_safe(9)
and that's the page, bestie π it lives in ./include/drm, dated October 2026, from the Kernel API Manual β go forth and iterate safely πβ¨ no cap π«Ά
π¦ 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