diff options
author | Christian König <christian.koenig@amd.com> | 2017-04-20 06:11:47 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-04-28 17:32:52 -0400 |
commit | 4fcae787866915161f22d627328fa8d2e13d215b (patch) | |
tree | 39cb77afc487abb8816f61ef6729225be808b8ee /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |
parent | 4bae05e196c518c2c95022fbdbee551bbc6893a5 (diff) |
drm/amdgpu: fix amdgpu_ttm_bo_eviction_valuable
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 <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 23f7fe8fdc3d..eadbcfad2299 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -1040,11 +1040,17 @@ uint64_t amdgpu_ttm_tt_pte_flags(struct amdgpu_device *adev, struct ttm_tt *ttm, | |||
1040 | static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, | 1040 | static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, |
1041 | const struct ttm_place *place) | 1041 | const struct ttm_place *place) |
1042 | { | 1042 | { |
1043 | if (bo->mem.mem_type == TTM_PL_VRAM && | 1043 | unsigned long num_pages = bo->mem.num_pages; |
1044 | bo->mem.start == AMDGPU_BO_INVALID_OFFSET) { | 1044 | struct drm_mm_node *node = bo->mem.mm_node; |
1045 | unsigned long num_pages = bo->mem.num_pages; | ||
1046 | struct drm_mm_node *node = bo->mem.mm_node; | ||
1047 | 1045 | ||
1046 | if (bo->mem.start != AMDGPU_BO_INVALID_OFFSET) | ||
1047 | return ttm_bo_eviction_valuable(bo, place); | ||
1048 | |||
1049 | switch (bo->mem.mem_type) { | ||
1050 | case TTM_PL_TT: | ||
1051 | return true; | ||
1052 | |||
1053 | case TTM_PL_VRAM: | ||
1048 | /* Check each drm MM node individually */ | 1054 | /* Check each drm MM node individually */ |
1049 | while (num_pages) { | 1055 | while (num_pages) { |
1050 | if (place->fpfn < (node->start + node->size) && | 1056 | if (place->fpfn < (node->start + node->size) && |
@@ -1054,8 +1060,10 @@ static bool amdgpu_ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, | |||
1054 | num_pages -= node->size; | 1060 | num_pages -= node->size; |
1055 | ++node; | 1061 | ++node; |
1056 | } | 1062 | } |
1063 | break; | ||
1057 | 1064 | ||
1058 | return false; | 1065 | default: |
1066 | break; | ||
1059 | } | 1067 | } |
1060 | 1068 | ||
1061 | return ttm_bo_eviction_valuable(bo, place); | 1069 | return ttm_bo_eviction_valuable(bo, place); |