[PATCH] mm/cma: pairing the trace_cma_alloc_start/finish

Richard Chang posted 1 patch 6 months, 2 weeks ago
mm/cma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] mm/cma: pairing the trace_cma_alloc_start/finish
Posted by Richard Chang 6 months, 2 weeks ago
In the bad input validation cases, there is no
trace_cma_alloc_finish to match the trace_cma_alloc_start.
Move the trace_cma_alloc_start event after the validations.

Signed-off-by: Richard Chang <richardycc@google.com>
---
 mm/cma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/cma.c b/mm/cma.c
index 397567883a10..bd3772773736 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -854,8 +854,6 @@ static struct page *__cma_alloc(struct cma *cma, unsigned long count,
 	unsigned long i;
 	const char *name = cma ? cma->name : NULL;
 
-	trace_cma_alloc_start(name, count, align);
-
 	if (!cma || !cma->count)
 		return page;
 
@@ -865,6 +863,8 @@ static struct page *__cma_alloc(struct cma *cma, unsigned long count,
 	if (!count)
 		return page;
 
+	trace_cma_alloc_start(name, count, align);
+
 	for (r = 0; r < cma->nranges; r++) {
 		page = NULL;
 
-- 
2.50.0.rc0.604.gd4ff7b7c86-goog
Re: [PATCH] mm/cma: pairing the trace_cma_alloc_start/finish
Posted by David Hildenbrand 6 months, 2 weeks ago
On 05.06.25 09:25, Richard Chang wrote:
> In the bad input validation cases, there is no
> trace_cma_alloc_finish to match the trace_cma_alloc_start.
> Move the trace_cma_alloc_start event after the validations.
> 
> Signed-off-by: Richard Chang <richardycc@google.com>
> ---
>   mm/cma.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/cma.c b/mm/cma.c
> index 397567883a10..bd3772773736 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -854,8 +854,6 @@ static struct page *__cma_alloc(struct cma *cma, unsigned long count,
>   	unsigned long i;
>   	const char *name = cma ? cma->name : NULL;
>   
> -	trace_cma_alloc_start(name, count, align);
> -
>   	if (!cma || !cma->count)
>   		return page;
>   
> @@ -865,6 +863,8 @@ static struct page *__cma_alloc(struct cma *cma, unsigned long count,
>   	if (!count)
>   		return page;
>   
> +	trace_cma_alloc_start(name, count, align);
> +
>   	for (r = 0; r < cma->nranges; r++) {
>   		page = NULL;
>   

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

-- 
Cheers,

David / dhildenb