]> Git Repo - J-linux.git/commitdiff
drm/ttm: Double check mem_type of BO while eviction
authorxinhui pan <[email protected]>
Wed, 10 Nov 2021 04:31:49 +0000 (12:31 +0800)
committerChristian König <[email protected]>
Thu, 11 Nov 2021 08:08:08 +0000 (09:08 +0100)
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 <[email protected]>
Signed-off-by: xinhui pan <[email protected]>
Reviewed-by: Christian König <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Christian König <[email protected]>
drivers/gpu/drm/ttm/ttm_bo.c

index bb9e02c31946e906bd5c2533082fe6c76055689b..1ddf458aed71cddd1e7542e78dd7b7a46a982fc1 100644 (file)
@@ -617,7 +617,8 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
                        *busy = !ret;
        }
 
-       if (ret && place && !bo->bdev->funcs->eviction_valuable(bo, place)) {
+       if (ret && place && (bo->resource->mem_type != place->mem_type ||
+               !bo->bdev->funcs->eviction_valuable(bo, place))) {
                ret = false;
                if (*locked) {
                        dma_resv_unlock(bo->base.resv);
This page took 0.055437 seconds and 4 git commands to generate.