drm_gem_lru_scan(9)
π drm_gem_lru_scan(9) β the kernel API manual, but make it cute π
okay so bestie, we're in the Kernel API Manual and this one is called drm_gem_lru_scan. it's a helper to implement shrinker.scan_objects, no cap. let's get into it π
β¨ NAME β¨
drm_gem_lru_scan β a little helper that does the shrinker.scan_objects thing for you π«Ά
πΈ SYNOPSIS πΈ
unsigned long drm_gem_lru_scan (struct drm_device *dev , struct
drm_gem_lru *lru , unsigned int nr_to_scan , unsigned long *remaining ,
bool (*shrink)(struct drm_gem_object *obj, struct ww_acquire_ctx
*ticket) , struct ww_acquire_ctx *ticket );
π¦ ARGUMENTS π¦
devβ the DRM device this LRU belongs to. it's giving "who's your parent" energy πlruβ the LRU we're scanning. yes, that LRU πnr_to_scanβ how many pages we're gonna try to reclaim. it's the page count goal, periodt β¨remainingβ the number of pages left to reclaim, and the caller is supposed to initialize this one. don't forget, bestie πshrinkβ the callback that tries to shrink/reclaim the object. main character energy fr π₯ticketβ an optionalww_acquire_ctxcontext to use for locking. optional, so you can skip it if you want π
π DESCRIPTION π
okay so if the shrink callback succeeds, the driver is expected to move the object out of this LRU. that's the vibe check β callback pops off, object leaves π
and if the LRU possibly contains active buffers, it's the responsibility of the shrink callback to check for that (like, dma_resv_test_signaled) or, if necessary, block until the buffer becomes idle. yes, that's on the callback, not on this function, sorry bestie π
π SEE ALSO π
Kernel file ./drivers/gpu/drm/drm_gem.c plus the whole friend group:
drm_gem_huge_mnt_create(9),
drm_gem_init(9),
drm_gem_object_init(9),
drm_gem_private_object_init(9),
drm_gem_private_object_fini(9),
drm_gem_object_handle_get_if_exists_unlocked(9),
drm_gem_object_handle_free(9),
drm_gem_object_handle_put_unlocked(9),
drm_gem_handle_delete(9),
drm_gem_dumb_map_offset(9),
drm_gem_handle_create_tail(9),
drm_gem_handle_create(9),
drm_gem_free_mmap_offset(9),
drm_gem_create_mmap_offset_size(9),
drm_gem_create_mmap_offset(9),
drm_gem_get_pages(9),
drm_gem_put_pages(9),
drm_gem_objects_lookup(9),
drm_gem_object_lookup(9),
drm_gem_dma_resv_wait(9),
drm_gem_open(9),
drm_gem_release(9),
drm_gem_object_release(9),
drm_gem_object_free(9),
drm_gem_vm_open(9),
drm_gem_vm_close(9),
drm_gem_mmap_obj(9),
drm_gem_get_unmapped_area(9),
drm_gem_mmap(9),
drm_gem_lock_reservations(9),
drm_gem_lru_init(9),
drm_gem_lru_remove(9),
drm_gem_lru_move_tail_locked(9),
drm_gem_lru_move_tail(9),
drm_gem_evict_locked(9)
literally the whole squad, iykyk π
ngl this whole thing lives at./drivers/gpu/drmand it's from October 2026, and it's thedrm_gem_lru_scan(9)page. slay. that's the whole manpage bestie, mwah πβ¨ππ¦πΈ
π¦ 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