i915_gem_evict_vm(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… i915_gem_evict_vm β€” like, the kernel API manual page for it, bestie ✨

Okay so real talk, this page lives in the Linux Kernel API Manual and the function it's serving is literally called i915_gem_evict_vm. Yes the title's a mouthful, no we're not renaming it πŸ’€


✨ NAME ✨

i915_gem_evict_vm β€” evict all the idle vmas from a vm. That's it, that's the whole job, no cap 🧹


πŸŽ€ SYNOPSIS πŸŽ€

int i915_gem_evict_vm(struct i915_address_space *vm,
                      struct i915_gem_ww_ctx *ww,
                      struct drm_i915_gem_object **busy_bo);

Like, look at her. Three args, returns an int, main character energy fr fr πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • vm β€” the address space you're cleansing 🌸 this is the thing getting scrubbed, okay?
  • ww β€” an optional struct i915_gem_ww_ctx. If it's not NULL, then i915_gem_evict_vm will totally be able to evict vma's locked by the ww as well. Teamwork, slay 🫢
  • busy_bo β€” optional pointer to a struct drm_i915_gem_object. And okay, this one's important so like, listen up bestie:
    • if it's not NULL, then in the event i915_gem_evict_vm can't trylock an object for eviction, busy_bo will point to it 🎯
    • -EBUSY is also returned in that case, bestie, that's the vibe check failing 😭
    • the caller must drop the vm->mutex before trying again to acquire the contended lock ⚠️ like, do not skip this step, I'm so serious
    • the caller also owns a reference to the object, so like, congrats, that's yours now πŸ’–

🌈 DESCRIPTION 🌈

This function evicts all the vmas from a vm. All of them. The whole friend group 🧚

It's used by the execbuf code as a last-ditch effort to defragment the address space β€” think of it as the "okay we've tried literally everything else" era of the operation 😀

And to clarify, because people stay getting confused: this is for freeing up virtual address space, not for freeing memory in e.g. the shrinker. Different thing entirely, bestie, don't conflate them πŸ™ˆ


⭐ SEE ALSO ⭐

Kernel file ./drivers/gpu/drm/i915/i915_gem_evict.c β€” go read her, she's iconic πŸ“–

Both linked, both relevant, iykyk πŸ’œ


And that's the page!! Shoutout to ./drivers/gpu/drm/i915 for hosting this whole situation, dated October 2026, periodt πŸŽ€πŸ’…

πŸ“¦ where this page comes from