Skip to contentSkip to conversation

mm/cma: Change the addition of totalcma_pages in the cma_init_reserved_mem

PATCH Applied Hao Ge 2 participants 2 messages Jul 29, 2024 – Aug 1, 2024

Subsystems (2)
lore
Share & tools
lore

Hao Ge

author
#0 lore raw

PATCH 1/1 mm/cma: Change the addition of totalcma_pages in the cma_init_reserved_mem

From: Hao Ge <[email protected]>

Replace the unnecessary division calculation with cma->count when update the value of totalcma_pages.

---
 mm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/cma.c +1 -1
index 3e9724716bad..95d6950e177b 100644
@@ -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;
 }
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Hao Ge

From: Hao Ge <[email protected]>

Replace the unnecessary division calculation with cma->count when update the value of totalcma_pages.

---
  mm/cma.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
mm/cma.c +0 -0
index 3e9724716bad..95d6950e177b 100644

mm/cma.c int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, · line 208

Quoted 8 lines
mm/cma.c +1 -1
@@ -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;
  }
Signature · 3 lines
Cheers,

David / dhildenb