drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable
From: Christian König <[email protected]>
BOs not mapped into the GART are always valuable for an eviction. Otherwise we don't correctly swap them out on VRAM evictions during memory pressure.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +13 -5
@@ -1040,11 +1040,17 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,static bool amdgpu_ttm_bo_eviction_valuable (struct ttm_buffer_object *bo,const struct ttm_place *place) { -if (bo->mem.mem_type ==TTM_PL_VRAM && - bo->mem.start ==AMDGPU_BO_INVALID_OFFSET ) { -unsigned long num_pages = bo->mem.num_pages; -struct drm_mm_node *node = bo->mem.mm_node; +unsigned long num_pages = bo->mem.num_pages; +struct drm_mm_node *node = bo->mem.mm_node; +if (bo->mem.start !=AMDGPU_BO_INVALID_OFFSET ) +return ttm_bo_eviction_valuable (bo, place); + +switch (bo->mem.mem_type) { +case TTM_PL_TT : +return true; + +case TTM_PL_VRAM :/* Check each drm MM node individually */ while (num_pages) { if (place->fpfn < (node->start + node->size) &&
@@ -1054,8 +1060,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, num_pages -= node->size; ++node; } +break ; -return false; +default : +break ; }return ttm_bo_eviction_valuable (bo, place);
Signature · 6 lines
2.5.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1492688977-1757-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Alex Deucher
Reviewed-byQuoted 6 lines · Christian König
From: Christian König <[email protected]>
BOs not mapped into the GART are always valuable for an eviction. Otherwise we don't correctly swap them out on VRAM evictions during memory pressure.
Signed-off-by Christian König <[email protected]>
Quoted 45 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +13
-6@@ -1040,11 +1040,17 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,static bool amdgpu_ttm_bo_eviction_valuable (struct ttm_buffer_object *bo,const struct ttm_place *place) { -if (bo->mem.mem_type ==TTM_PL_VRAM && - bo->mem.start ==AMDGPU_BO_INVALID_OFFSET ) { -unsigned long num_pages = bo->mem.num_pages; -struct drm_mm_node *node = bo->mem.mm_node; +unsigned long num_pages = bo->mem.num_pages; +struct drm_mm_node *node = bo->mem.mm_node; +if (bo->mem.start !=AMDGPU_BO_INVALID_OFFSET ) +return ttm_bo_eviction_valuable (bo, place); + +switch (bo->mem.mem_type) { +case TTM_PL_TT : +return true; + +case TTM_PL_VRAM :/* Check each drm MM node individually */ while (num_pages) { if (place->fpfn < (node->start + node->size) &&@@ -1054,8 +1060,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, num_pages -= node->size; ++node; } +break ; -return false; +default : +break ; }return ttm_bo_eviction_valuable (bo, place); --2.5.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CADnq5_N2KHdP3vkiY4Cfg6dKEqk1kF8_17N6s9H_0E7yQNDciA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 9 lines · Alex Deucher
Quoted 6 lines · Christian König
From: Christian König <[email protected]>
BOs not mapped into the GART are always valuable for an eviction. Otherwise we don't correctly swap them out on VRAM evictions during memory pressure.
Signed-off-by Christian König <[email protected]>Reviewed-by Alex Deucher <[email protected]>
Although it doesn't fix my issue, it seems more reasonable compared previous, Reviewed-by: Chunming Zhou <[email protected]>
Quoted 46 lines
Quoted 46 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +13
-6@@ -1040,11 +1040,17 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm,static bool amdgpu_ttm_bo_eviction_valuable (struct ttm_buffer_object *bo,const struct ttm_place *place) { -if (bo->mem.mem_type ==TTM_PL_VRAM && - bo->mem.start ==AMDGPU_BO_INVALID_OFFSET ) { -unsigned long num_pages = bo->mem.num_pages; -struct drm_mm_node *node = bo->mem.mm_node; +unsigned long num_pages = bo->mem.num_pages; +struct drm_mm_node *node = bo->mem.mm_node; +if (bo->mem.start !=AMDGPU_BO_INVALID_OFFSET ) +return ttm_bo_eviction_valuable (bo, place); + +switch (bo->mem.mem_type) { +case TTM_PL_TT : +return true; + +case TTM_PL_VRAM :/* Check each drm MM node individually */ while (num_pages) { if (place->fpfn < (node->start + node->size) &&@@ -1054,8 +1060,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, num_pages -= node->size; ++node; } +break ; -return false; +default : +break ; }return ttm_bo_eviction_valuable (bo, place); --2.5.0
Quoted 8 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx