drm/ttm: max_cpages is in unit of native page
authorMonk Liu <[email protected]>
Fri, 1 Dec 2017 10:23:56 +0000 (18:23 +0800)
committerAlex Deucher <[email protected]>
Tue, 12 Dec 2017 20:39:45 +0000 (15:39 -0500)
fix calculation.

Signed-off-by: Monk Liu <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
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);