Re: [PATCH 1/3] drm/ttm: use try_lock in ttm_bo_delayed_delete again

2017-12-17 Thread Thomas Hellstrom

This series,

Reviewed-by: Thomas Hellstrom 




On 12/15/2017 07:31 PM, Christian König wrote:

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: Christian König 
---
  drivers/gpu/drm/ttm/ttm_bo.c | 13 +
  1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index ba5b48617bba..122a964cac40 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -586,12 +586,17 @@ static bool ttm_bo_delayed_delete(struct ttm_bo_device 
*bdev, bool remove_all)
  ddestroy);
kref_get(>list_kref);
list_move_tail(>ddestroy, );
-   spin_unlock(>lru_lock);
  
-		reservation_object_lock(bo->resv, NULL);

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

-   ttm_bo_cleanup_refs(bo, false, !remove_all, true);
+   spin_lock(>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(>list_kref, ttm_bo_release_list);

spin_lock(>lru_lock);



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/3] drm/ttm: use try_lock in ttm_bo_delayed_delete again

2017-12-15 Thread Christian König
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: Christian König 
---
 drivers/gpu/drm/ttm/ttm_bo.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index ba5b48617bba..122a964cac40 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -586,12 +586,17 @@ static bool ttm_bo_delayed_delete(struct ttm_bo_device 
*bdev, bool remove_all)
  ddestroy);
kref_get(>list_kref);
list_move_tail(>ddestroy, );
-   spin_unlock(>lru_lock);
 
-   reservation_object_lock(bo->resv, NULL);
+   if (remove_all || bo->resv != >ttm_resv) {
+   spin_unlock(>lru_lock);
+   reservation_object_lock(bo->resv, NULL);
 
-   spin_lock(>lru_lock);
-   ttm_bo_cleanup_refs(bo, false, !remove_all, true);
+   spin_lock(>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(>list_kref, ttm_bo_release_list);
spin_lock(>lru_lock);
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel