aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger He <Hongbo.He@amd.com>2018-01-11 04:00:14 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-01-16 15:35:27 -0500
commit9483ce7c6ed5980fcc45643d391b17317b40406a (patch)
tree95c02547c4952b99089f47cf684140cdf6aafc31
parent83fbb788a49c11477d42ca323cf16c109d426d70 (diff)
drm/ttm: only free pages rather than update global memory count together
if ttm_get_pages or ttm_mem_global_alloc_page fail, should not update global memory count. Signed-off-by: Roger He <Hongbo.He@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Tested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index e48e387d4d17..6288389e6959 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -1073,7 +1073,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
1073 ret = ttm_get_pages(ttm->pages, ttm->num_pages, ttm->page_flags, 1073 ret = ttm_get_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
1074 ttm->caching_state); 1074 ttm->caching_state);
1075 if (unlikely(ret != 0)) { 1075 if (unlikely(ret != 0)) {
1076 ttm_pool_unpopulate(ttm); 1076 ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
1077 ttm->caching_state);
1077 return ret; 1078 return ret;
1078 } 1079 }
1079 1080
@@ -1081,7 +1082,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
1081 ret = ttm_mem_global_alloc_page(mem_glob, ttm->pages[i], 1082 ret = ttm_mem_global_alloc_page(mem_glob, ttm->pages[i],
1082 PAGE_SIZE, ctx); 1083 PAGE_SIZE, ctx);
1083 if (unlikely(ret != 0)) { 1084 if (unlikely(ret != 0)) {
1084 ttm_pool_unpopulate(ttm); 1085 ttm_put_pages(ttm->pages, ttm->num_pages,
1086 ttm->page_flags, ttm->caching_state);
1085 return -ENOMEM; 1087 return -ENOMEM;
1086 } 1088 }
1087 } 1089 }