• Thomas Hellström's avatar
    drm/ttm: Use the LRU walker for eviction · 3756310e
    Thomas Hellström authored
    Use the LRU walker for eviction. This helps
    removing a lot of code with weird locking
    semantics.
    
    The functionality is slightly changed so that
    when trylocked buffer objects are exhausted, we
    continue to interleave walks with ticket-locks while
    there is still progress made. The list walks are
    not restarted in-between evictions.
    
    Also provide a separate ttm_bo_evict_first()
    function for its single user. The context of that
    user allows sleeping dma_resv locks.
    
    v6:
    - Various cleanups suggested by Matthew Brost.
    - Fix error return code of ttm_bo_evict_first(). (Matthew Brost)
    - Fix an error check that was inverted. (Matthew Brost)
    v7:
    - Use s64 rather than long (Christian König)
    - Early ttm_resource_cursor_fini() in ttm_bo_evict_first().
    - Simplify check for bo_moved in ttm_bo_evict_first().
      (Christian König)
    - Don't evict pinned bos.
    
    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: Matthew Brost <matthew.brost@intel.com> #v6
    Link: https://patchwork.freedesktop.org/patch/msgid/20240705153206.68526-8-thomas.hellstrom@linux.intel.comSigned-off-by: default avatarChristian König <christian.koenig@amd.com>
    3756310e
ttm_bo.c 30.6 KB