i915_gem_shrink(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… i915_gem_shrink πŸ’…

okay so bestie, this is the i915_gem_shrink(9) page from the Kernel API Manual, and it’s literally the glow-up guide for shrinking buffer object caches. no cap, it’s giving β€œmemory reclaim but make it fashion.” πŸŽ€

✨ NAME ✨

i915_gem_shrink β€” Shrink buffer object caches

πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned long i915_gem_shrink (struct i915_gem_ww_ctx *ww , struct
       drm_i915_private *i915 , unsigned long target , unsigned long
       *nr_scanned , unsigned int shrink );

πŸŽ€ ARGUMENTS πŸŽ€

  • ww β€” the i915 gem ww acquire ctx, or NULL. lowkey optional vibes 🫢
  • i915 β€” the i915 device. main character energy πŸ–₯️
  • target β€” amount of memory to make available, in pages. yes, pages, not vibes.
  • nr_scanned β€” optional output for number of pages scanned (incremental). it’s the receipts ✨
  • shrink β€” control flags for selecting cache types. choose your fighter πŸ’…

🌸 DESCRIPTION 🌸

This function is literally the main interface to the shrinker. It will try to release up to target pages of main memory backing storage from buffer objects. Selection of the specific caches can be done with flags. This is e.g. useful when purgeable objects should be removed from caches preferentially. iykyk 🧚

Note that it’s not guaranteed that the released amount is actually available as free system memory β€” the pages might still be in use due to other reasons (like cpu mmaps) or the mm core has reused them before we could grab them. 😭 so if your code needs to explicitly shrink buffer object caches (e.g. to avoid deadlocks in memory reclaim), it must fall back to i915_gem_shrink_all. periodt.

Also note that any kind of pinning (both per-vma address space pins and backing storage pins at the buffer object level) result in the shrinker code having to skip the object. πŸ’€ no cap, pinned objects are not getting shrunk.

πŸ”₯ RETURN πŸ”₯

The number of pages of backing storage actually released. that’s the whole bag πŸ’°

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/gpu/drm/i915/gem/i915_gem_shrinker.c


okay bestie that’s the whole page πŸ’– source/version is ./drivers/gpu/drm/i915/gem, dated October 2026, and yes the manual page is i915_gem_shrink(9). slay, go shrink responsibly 🫢✨

πŸ“¦ where this page comes from