• Thomas Hellström's avatar
    drm/ttm: Use LRU hitches · 8e9bf0fb
    Thomas Hellström authored
    Have iterators insert themselves into the list they are iterating
    over using hitch list nodes. Since only the iterator owner
    can remove these list nodes from the list, it's safe to unlock
    the list and when continuing, use them as a starting point. Due to
    the way LRU bumping works in TTM, newly added items will not be
    missed, and bumped items will be iterated over a second time before
    reaching the end of the list.
    
    The exception is list with bulk move sublists. When bumping a
    sublist, a hitch that is part of that sublist will also be moved
    and we might miss items if restarting from it. This will be
    addressed in a later patch.
    
    Changes in previous series:
    - Updated ttm_resource_cursor_fini() documentation.
    v2:
    - Don't reorder ttm_resource_manager_first() and _next().
      (Christian König).
    - Use list_add instead of list_move
      (Christian König)
    v3:
    - Split into two patches, one cleanup, one new functionality
      (Christian König)
    - use ttm_resource_cursor_fini_locked() instead of open-coding
      (Matthew Brost)
    
    Cc: Christian König <christian.koenig@amd.com>
    Cc: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
    Cc: Matthew Brost <matthew.brost@intel.com>
    Cc: <dri-devel@lists.freedesktop.org>
    Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
    Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
    Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240705153206.68526-4-thomas.hellstrom@linux.intel.comSigned-off-by: default avatarChristian König <christian.koenig@amd.com>
    8e9bf0fb
ttm_resource.c 22.1 KB