linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/cma: Change the addition of totalcma_pages in the cma_init_reserved_mem
@ 2024-07-29  8:04 Hao Ge
  2024-08-01  9:28 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Hao Ge @ 2024-07-29  8:04 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Hao Ge

From: Hao Ge <gehao@kylinos.cn>

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

Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
 mm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/cma.c b/mm/cma.c
index 3e9724716bad..95d6950e177b 100644
--- 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;
 }
-- 
2.25.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/cma: Change the addition of totalcma_pages in the cma_init_reserved_mem
  2024-07-29  8:04 [PATCH] mm/cma: Change the addition of totalcma_pages in the cma_init_reserved_mem Hao Ge
@ 2024-08-01  9:28 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2024-08-01  9:28 UTC (permalink / raw)
  To: Hao Ge, akpm; +Cc: linux-mm, linux-kernel, Hao Ge

On 29.07.24 10:04, Hao Ge wrote:
> From: Hao Ge <gehao@kylinos.cn>
> 
> Replace the unnecessary division calculation with cma->count
> when update the value of totalcma_pages.
> 
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
> ---
>   mm/cma.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/cma.c b/mm/cma.c
> index 3e9724716bad..95d6950e177b 100644
> --- 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;
>   }

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-01  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-29  8:04 [PATCH] mm/cma: Change the addition of totalcma_pages in the cma_init_reserved_mem Hao Ge
2024-08-01  9:28 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox