Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>
Link: https://patchwork.freedesktop.org/patch/335246/

+3 -2
+3 -2
drivers/gpu/drm/ttm/ttm_bo.c
··· 185 185 list_add_tail(&bo->lru, &man->lru[bo->priority]); 186 186 kref_get(&bo->list_kref); 187 187 188 - if (bo->ttm && !(bo->ttm->page_flags & 189 - (TTM_PAGE_FLAG_SG | TTM_PAGE_FLAG_SWAPPED))) { 188 + if (!(man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm && 189 + !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG | 190 + TTM_PAGE_FLAG_SWAPPED))) { 190 191 list_add_tail(&bo->swap, &bdev->glob->swap_lru[bo->priority]); 191 192 kref_get(&bo->list_kref); 192 193 }