i915_gem_shrink(9)
π 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, orNULL. 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
i915_gem_shrink_all(9)i915_gem_object_make_unshrinkable(9)__i915_gem_object_make_shrinkable(9)__i915_gem_object_make_purgeable(9)i915_gem_object_make_shrinkable(9)i915_gem_object_make_purgeable(9)
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
- 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