Commit 2f44172b authored by Christian König's avatar Christian König Committed by Alex Deucher

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: default avatarChristian König <christian.koenig@amd.com>
Acked-by: default avatarOak Zeng <Oak.Zeng@amd.com>
Tested-by: default avatarNirmoy Das <nirmoy.das@amd.com>
Reviewed-by: default avatarArunpravin <Arunpravin.PaneerSelvam@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 755eadf6
...@@ -1398,7 +1398,7 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, ...@@ -1398,7 +1398,7 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
const struct ttm_place *place) const struct ttm_place *place)
{ {
unsigned long num_pages = bo->mem.num_pages; 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_resv_list *flist;
struct dma_fence *f; struct dma_fence *f;
int i; int i;
...@@ -1430,13 +1430,15 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, ...@@ -1430,13 +1430,15 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
case TTM_PL_VRAM: case TTM_PL_VRAM:
/* Check each drm MM node individually */ /* Check each drm MM node individually */
while (num_pages) { amdgpu_res_first(&bo->mem, 0, (u64)num_pages << PAGE_SHIFT,
if (place->fpfn < (node->start + node->size) && &cursor);
!(place->lpfn && place->lpfn <= node->start)) while (cursor.remaining) {
if (place->fpfn < PFN_DOWN(cursor.start + cursor.size)
&& !(place->lpfn &&
place->lpfn <= PFN_DOWN(cursor.start)))
return true; return true;
num_pages -= node->size; amdgpu_res_next(&cursor, cursor.size);
++node;
} }
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment