Skip to content

Commit

Permalink
drm/ttm: fix handling in ttm_bo_add_mem_to_lru
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Kevin Wang <[email protected]>
Link: https://patchwork.freedesktop.org/patch/335246/
  • Loading branch information
ChristianKoenigAMD authored and evadot committed Aug 4, 2020
1 parent 1f69e7d commit 1e419a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/gpu/drm/ttm/ttm_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ static void ttm_bo_add_mem_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);
}
Expand Down

0 comments on commit 1e419a5

Please sign in to comment.