Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 827ed2b0 authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

drm/ttm: use try_lock in ttm_bo_delayed_delete again



We only need to wait for the contended lock when the reservation object is
shared or when we want to remove everything. A trylock should be sufficient
in all other cases.

Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarRoger He <Hongbo.He@amd.com>
Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3b1186fd
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -586,13 +586,18 @@ static bool ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all)
				      ddestroy);
		kref_get(&bo->list_kref);
		list_move_tail(&bo->ddestroy, &removed);
		spin_unlock(&glob->lru_lock);

		if (remove_all || bo->resv != &bo->ttm_resv) {
			spin_unlock(&glob->lru_lock);
			reservation_object_lock(bo->resv, NULL);

			spin_lock(&glob->lru_lock);
			ttm_bo_cleanup_refs(bo, false, !remove_all, true);

		} else if (reservation_object_trylock(bo->resv)) {
			ttm_bo_cleanup_refs(bo, false, !remove_all, true);
		}

		kref_put(&bo->list_kref, ttm_bo_release_list);
		spin_lock(&glob->lru_lock);
	}