]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/cma: change the addition of totalcma_pages in the cma_init_reserved_mem
authorHao Ge <gehao@kylinos.cn>
Mon, 29 Jul 2024 08:04:31 +0000 (16:04 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 2 Sep 2024 03:25:56 +0000 (20:25 -0700)
Replace the unnecessary division calculation with cma->count when update
the value of totalcma_pages.

Link: https://lkml.kernel.org/r/20240729080431.70916-1-hao.ge@linux.dev
Signed-off-by: Hao Ge <gehao@kylinos.cn>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/cma.c

index 3e9724716bad87a2d1f1a7d2184864845f3e289d..95d6950e177b575c41c1e26c59f61edd43eba18d 100644 (file)
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -202,7 +202,7 @@ int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
        cma->order_per_bit = order_per_bit;
        *res_cma = cma;
        cma_area_count++;
-       totalcma_pages += (size / PAGE_SIZE);
+       totalcma_pages += cma->count;
 
        return 0;
 }