Previously we always grabbed the BO reference after taking the lock, but that isn't necessary any more.
So avoid doing that and cleanup the handling here. Signed-off-by: Christian König <christian.koe...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo_util.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index dec60a41185d..a903529c2b1f 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -979,14 +979,17 @@ __ttm_bo_lru_cursor_next(struct ttm_bo_lru_cursor *curs) break; bo = res->bo; - if (ttm_lru_walk_trylock(curs, bo)) - bo_locked = true; - else if (!arg->ticket || arg->ctx->no_wait_gpu || arg->trylock_only) + if (!ttm_bo_get_unless_zero(bo)) continue; - if (!ttm_bo_get_unless_zero(bo)) { - if (curs->needs_unlock) - dma_resv_unlock(bo->base.resv); + if (ttm_lru_walk_trylock(curs, bo)) { + bo_locked = true; + + } else if (!arg->ticket || arg->ctx->no_wait_gpu || + arg->trylock_only) { + spin_unlock(lru_lock); + ttm_bo_put(bo); + spin_lock(lru_lock); continue; } -- 2.43.0