Skip to content

Commit 7120a44

Browse files
xinhui panChristianKoenigAMD
authored andcommitted
drm/ttm: Double check mem_type of BO while eviction
BO might sit in a wrong lru list as there is a small period of memory moving and lru list updating. Lets skip eviction if we hit such mismatch. Suggested-by: Christian König <christian.koenig@amd.com> Signed-off-by: xinhui pan <xinhui.pan@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211110043149.57554-2-xinhui.pan@amd.com Signed-off-by: Christian König <christian.koenig@amd.com>
1 parent f55aaf6 commit 7120a44

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,8 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
617617
*busy = !ret;
618618
}
619619

620-
if (ret && place && !bo->bdev->funcs->eviction_valuable(bo, place)) {
620+
if (ret && place && (bo->resource->mem_type != place->mem_type ||
621+
!bo->bdev->funcs->eviction_valuable(bo, place))) {
621622
ret = false;
622623
if (*locked) {
623624
dma_resv_unlock(bo->base.resv);

0 commit comments

Comments
 (0)