Skip to content

Commit

Permalink
drm/ttm: Don't add swapped BOs to swap-LRU list
Browse files Browse the repository at this point in the history
A BO that's already swapped would be added back to the swap-LRU list
for example if it validation failed under high memory pressure. This
could later lead to swapping it out again and leaking previous swap
storage.

This commit adds a condition to prevent that from happening.

Change-Id: I5f1fd06652ed8fc82f9f2c6c94ab3921a6c85b7a
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
  • Loading branch information
Felix Kuehling authored and Felix Kuehling committed Jan 20, 2018
1 parent 143135f commit 8cdadac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/ttm/ttm_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ 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)) {
if (bo->ttm && !(bo->ttm->page_flags &
(TTM_PAGE_FLAG_SG | TTM_PAGE_FLAG_SWAPPED))) {
list_add_tail(&bo->swap,
&bo->glob->swap_lru[bo->priority]);
kref_get(&bo->list_kref);
Expand Down

0 comments on commit 8cdadac

Please sign in to comment.