diff mbox

[2/2] drm/ttm: only free pages rather than update global memory count together

Message ID 1515737657-2983-2-git-send-email-Hongbo.He@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

He, Hongbo Jan. 12, 2018, 6:14 a.m. UTC
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>
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andrey Grodzovsky Jan. 12, 2018, 6:55 a.m. UTC | #1
Both patches

Tested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>


Andrey


On 01/12/2018 01:14 AM, Roger He wrote:
> 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>
> ---
>   drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 ++++--
>   1 file 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 0eab24e..aebabf1 100644
> --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
> @@ -1075,7 +1075,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>   	ret = ttm_get_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
>   			    ttm->caching_state);
>   	if (unlikely(ret != 0)) {
> -		ttm_pool_unpopulate(ttm);
> +		ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
> +			ttm->caching_state);
>   		return ret;
>   	}
>   
> @@ -1083,7 +1084,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>   		ret = ttm_mem_global_alloc_page(mem_glob, ttm->pages[i],
>   						PAGE_SIZE, ctx);
>   		if (unlikely(ret != 0)) {
> -			ttm_pool_unpopulate(ttm);
> +			ttm_put_pages(ttm->pages, ttm->num_pages,
> +				ttm->page_flags, ttm->caching_state);
>   			return -ENOMEM;
>   		}
>   	}
Christian König Jan. 12, 2018, 7:58 a.m. UTC | #2
Am 12.01.2018 um 07:14 schrieb Roger He:
> 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>
> ---
>   drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 ++++--
>   1 file 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 0eab24e..aebabf1 100644
> --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
> @@ -1075,7 +1075,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>   	ret = ttm_get_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
>   			    ttm->caching_state);
>   	if (unlikely(ret != 0)) {
> -		ttm_pool_unpopulate(ttm);
> +		ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
> +			ttm->caching_state);

That is not correctly indented. The "ttm->caching_state" should be one 
the same column as the "ttm->pages" above. It looks like your editor 
only inserts tabs, not spaces.

Apart from that the patch is Reviewed-by: Christian König 
<christian.koenig@amd.com>.

Regards,
Christian.

>   		return ret;
>   	}
>   
> @@ -1083,7 +1084,8 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
>   		ret = ttm_mem_global_alloc_page(mem_glob, ttm->pages[i],
>   						PAGE_SIZE, ctx);
>   		if (unlikely(ret != 0)) {
> -			ttm_pool_unpopulate(ttm);
> +			ttm_put_pages(ttm->pages, ttm->num_pages,
> +				ttm->page_flags, ttm->caching_state);
>   			return -ENOMEM;
>   		}
>   	}
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 0eab24e..aebabf1 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -1075,7 +1075,8 @@  int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
 	ret = ttm_get_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
 			    ttm->caching_state);
 	if (unlikely(ret != 0)) {
-		ttm_pool_unpopulate(ttm);
+		ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
+			ttm->caching_state);
 		return ret;
 	}
 
@@ -1083,7 +1084,8 @@  int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
 		ret = ttm_mem_global_alloc_page(mem_glob, ttm->pages[i],
 						PAGE_SIZE, ctx);
 		if (unlikely(ret != 0)) {
-			ttm_pool_unpopulate(ttm);
+			ttm_put_pages(ttm->pages, ttm->num_pages,
+				ttm->page_flags, ttm->caching_state);
 			return -ENOMEM;
 		}
 	}