[PATCH 0/3] drm/ttm, drm/xe: Consolidate the Buffer Object LRU walks

Thomas Hellström thomas.hellstrom at linux.intel.com
Fri Jun 13 15:18:21 UTC 2025


This is a deferred task from the Xe bo shrinker addition.

TTM currently have two separate ways of doing buffer object LRU
walks, of which one is exposed to drivers. Both have their benefits
but we shouldn't be implementing the complex bo locking in
two different places. So implement the ttm_lru_walk_for_evict()
function in terms of the guarded iteration also exposed to drivers.

This means that when we get to implement locking using drm_exec,
we only need to do that in a single place.

Add ticketlocking support to the guarded iteration and modify
the iteration arguments.

Thomas Hellström (3):
  drm/ttm: Use a struct for the common part of struct ttm_lru_walk and
    struct ttm_bo_lru_cursor.
  drm/ttm, drm/xe: Modify the struct ttm_bo_lru_walk_cursor
    initialization
  drm/ttm, drm_xe, Implement ttm_lru_walk_for_evict() using the guarded
    LRU iteration

 drivers/gpu/drm/ttm/ttm_bo.c      |  24 ++--
 drivers/gpu/drm/ttm/ttm_bo_util.c | 186 ++++++++++++------------------
 drivers/gpu/drm/xe/xe_shrinker.c  |   8 +-
 include/drm/ttm/ttm_bo.h          |  44 ++++---
 4 files changed, 122 insertions(+), 140 deletions(-)

-- 
2.49.0



More information about the dri-devel mailing list