diff mbox

[2/4] drm/ttm: use NUM_PAGES_TO_ALLOC always

Message ID 1511256742-5601-3-git-send-email-Hongbo.He@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

He, Hongbo Nov. 21, 2017, 9:32 a.m. UTC
Change-Id: Ide96a1ccad9bb44b0bb0d80e123c2d810ba618ed
Signed-off-by: Roger He <Hongbo.He@amd.com>
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Christian König Nov. 21, 2017, 9:41 a.m. UTC | #1
Am 21.11.2017 um 10:32 schrieb Roger He:
> Change-Id: Ide96a1ccad9bb44b0bb0d80e123c2d810ba618ed
> Signed-off-by: Roger He <Hongbo.He@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/ttm/ttm_page_alloc.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
> index 2b83c52..27b2402 100644
> --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
> @@ -520,8 +520,7 @@ static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags,
>   	int r = 0;
>   	unsigned i, j, cpages;
>   	unsigned npages = 1 << order;
> -	unsigned max_cpages = min(count,
> -			(unsigned)(PAGE_SIZE/sizeof(struct page *)));
> +	unsigned max_cpages = min(count, (unsigned)NUM_PAGES_TO_ALLOC);
>   
>   	/* allocate array for page caching change */
>   	caching_array = kmalloc(max_cpages*sizeof(struct page *), GFP_KERNEL);
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 2b83c52..27b2402 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -520,8 +520,7 @@  static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags,
 	int r = 0;
 	unsigned i, j, cpages;
 	unsigned npages = 1 << order;
-	unsigned max_cpages = min(count,
-			(unsigned)(PAGE_SIZE/sizeof(struct page *)));
+	unsigned max_cpages = min(count, (unsigned)NUM_PAGES_TO_ALLOC);
 
 	/* allocate array for page caching change */
 	caching_array = kmalloc(max_cpages*sizeof(struct page *), GFP_KERNEL);