drm/gem: Consider GEM object reclaimable if shrinking fails

If the object wasn't moved to a different LRU after the shrink callback
returns, it means the buffer is still reclaimable. Update the remaining
counter to reflect that.

v2:
- Collect R-b

v3:
- Collect R-b

v4:
- No changes

v5:
- No changes

v6:
- No changes

v7:
- No changes

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20260401134854.2275433-2-boris.brezillon@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
This commit is contained in:
Boris Brezillon 2026-04-01 15:48:45 +02:00
parent 4b9c36c83b
commit 71c8224a18

View File

@ -1700,6 +1700,16 @@ drm_gem_lru_scan(struct drm_gem_lru *lru,
*/
WARN_ON(obj->lru == &still_in_lru);
WARN_ON(obj->lru == lru);
} else if (obj->lru == &still_in_lru) {
/*
* If the object wasn't moved and wasn't shrunk either,
* it's still remaining as reclaimable. Note that
* obj->lru is supposed to be checked with the LRU lock
* held for an accurate result, but we don't care about
* accuracy here. Worst thing that could happen is an
* extra scan.
*/
*remaining += obj->size >> PAGE_SHIFT;
}
dma_resv_unlock(obj->resv);