diff options
| author | Christian König <[email protected]> | 2021-02-17 18:43:34 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2021-03-24 03:30:00 +0000 |
| commit | 2f44172bdca7f52a3c52f5b89378e8da47909352 (patch) | |
| tree | 044d6e19364293379e762b8dfece54ea2b37d28d /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |
| parent | drm/amdgpu: use new cursor in amdgpu_mem_visible (diff) | |
| download | kernel-2f44172bdca7f52a3c52f5b89378e8da47909352.tar.gz kernel-2f44172bdca7f52a3c52f5b89378e8da47909352.zip | |
drm/amdgpu: use the new cursor in amdgpu_ttm_bo_eviction_valuable
Separate the drm_mm_node walking from the actual handling.
Signed-off-by: Christian König <[email protected]>
Acked-by: Oak Zeng <[email protected]>
Tested-by: Nirmoy Das <[email protected]>
Reviewed-by: Arunpravin <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 36ce6f7471e2..b51d0100532f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -1398,7 +1398,7 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, const struct ttm_place *place) { unsigned long num_pages = bo->mem.num_pages; - struct drm_mm_node *node = bo->mem.mm_node; + struct amdgpu_res_cursor cursor; struct dma_resv_list *flist; struct dma_fence *f; int i; @@ -1430,13 +1430,15 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, case TTM_PL_VRAM: /* Check each drm MM node individually */ - while (num_pages) { - if (place->fpfn < (node->start + node->size) && - !(place->lpfn && place->lpfn <= node->start)) + amdgpu_res_first(&bo->mem, 0, (u64)num_pages << PAGE_SHIFT, + &cursor); + while (cursor.remaining) { + if (place->fpfn < PFN_DOWN(cursor.start + cursor.size) + && !(place->lpfn && + place->lpfn <= PFN_DOWN(cursor.start))) return true; - num_pages -= node->size; - ++node; + amdgpu_res_next(&cursor, cursor.size); } return false; |
