drm/ttm: max_cpages is in unit of native page
authorMonk Liu <Monk.Liu@amd.com>
Fri, 1 Dec 2017 10:23:56 +0000 (18:23 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 12 Dec 2017 19:48:52 +0000 (14:48 -0500)
fix calculation.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/ttm/ttm_page_alloc.c

index 71945ccaf012c7939abcacfdfa863b0ff6107970..b5ba6441489f6e4f28f6e71129dfede3361bd262 100644 (file)
@@ -544,7 +544,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)NUM_PAGES_TO_ALLOC);
+       unsigned max_cpages = min(count << order, (unsigned)NUM_PAGES_TO_ALLOC);
 
        /* allocate array for page caching change */
        caching_array = kmalloc(max_cpages*sizeof(struct page *), GFP_KERNEL);