summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2019-10-10 13:24:17 +0200
committerKevin Wang <kevin1.wang@amd.com>2019-10-12 13:53:55 +0800
commit7432041a0332ec2343ca776111f91ff7528a3115 (patch)
tree77d63f533fbe485db60acd0bf46aaa0cc91e5a7f
parentdd3d754e7444ae50c1c440a0ad98c760a851a836 (diff)
drm/ttm: fix handling in ttm_bo_add_mem_to_lru
We should not add the BO to the swap LRU when the new mem is fixed and the TTM object about to be destroyed. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 1eff124d9a75..962f702940bf 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -184,8 +184,9 @@ void ttm_bo_add_to_lru(struct ttm_buffer_object *bo)
list_add_tail(&bo->lru, &man->lru[bo->priority]);
kref_get(&bo->list_kref);
- if (bo->ttm && !(bo->ttm->page_flags &
- (TTM_PAGE_FLAG_SG | TTM_PAGE_FLAG_SWAPPED))) {
+ if (!(man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm &&
+ !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |
+ TTM_PAGE_FLAG_SWAPPED))) {
list_add_tail(&bo->swap,
&bdev->glob->swap_lru[bo->priority]);
kref_get(&bo->list_kref);