aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger He <Hongbo.He@amd.com>2017-12-06 01:16:09 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-12-15 17:13:01 -0500
commit4985c9fc5f5231e93c4dcfd067d2c6a70e4fe6b8 (patch)
treeb1b46fa3aea3b63814497d48902ace1276cb973c
parent9251859a9adb8e5906402acc9d705149d937bf8b (diff)
drm/ttm: enable eviction for Per-VM-BO
allow eviction of BOs reserved by the caller when they are not part of the current working set. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Roger He <Hongbo.He@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 7a9abc2a3a98..17f64c836bf9 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -709,7 +709,6 @@ bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
709EXPORT_SYMBOL(ttm_bo_eviction_valuable); 709EXPORT_SYMBOL(ttm_bo_eviction_valuable);
710 710
711static int ttm_mem_evict_first(struct ttm_bo_device *bdev, 711static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
712 struct reservation_object *resv,
713 uint32_t mem_type, 712 uint32_t mem_type,
714 const struct ttm_place *place, 713 const struct ttm_place *place,
715 struct ttm_operation_ctx *ctx) 714 struct ttm_operation_ctx *ctx)
@@ -724,8 +723,9 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
724 spin_lock(&glob->lru_lock); 723 spin_lock(&glob->lru_lock);
725 for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { 724 for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) {
726 list_for_each_entry(bo, &man->lru[i], lru) { 725 list_for_each_entry(bo, &man->lru[i], lru) {
727 if (bo->resv == resv) { 726 if (bo->resv == ctx->resv) {
728 if (list_empty(&bo->ddestroy)) 727 if (!ctx->allow_reserved_eviction &&
728 list_empty(&bo->ddestroy))
729 continue; 729 continue;
730 } else { 730 } else {
731 locked = reservation_object_trylock(bo->resv); 731 locked = reservation_object_trylock(bo->resv);
@@ -837,7 +837,7 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
837 return ret; 837 return ret;
838 if (mem->mm_node) 838 if (mem->mm_node)
839 break; 839 break;
840 ret = ttm_mem_evict_first(bdev, bo->resv, mem_type, place, ctx); 840 ret = ttm_mem_evict_first(bdev, mem_type, place, ctx);
841 if (unlikely(ret != 0)) 841 if (unlikely(ret != 0))
842 return ret; 842 return ret;
843 } while (1); 843 } while (1);
@@ -1334,8 +1334,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
1334 for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { 1334 for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) {
1335 while (!list_empty(&man->lru[i])) { 1335 while (!list_empty(&man->lru[i])) {
1336 spin_unlock(&glob->lru_lock); 1336 spin_unlock(&glob->lru_lock);
1337 ret = ttm_mem_evict_first(bdev, NULL, mem_type, 1337 ret = ttm_mem_evict_first(bdev, mem_type, NULL, &ctx);
1338 NULL, &ctx);
1339 if (ret) 1338 if (ret)
1340 return ret; 1339 return ret;
1341 spin_lock(&glob->lru_lock); 1340 spin_lock(&glob->lru_lock);