]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/cma: pair the trace_cma_alloc_start/finish
authorRichard Chang <richardycc@google.com>
Thu, 5 Jun 2025 07:25:32 +0000 (07:25 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 10 Jul 2025 05:41:58 +0000 (22:41 -0700)
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.

Link: https://lkml.kernel.org/r/20250605072532.972081-1-richardycc@google.com
Signed-off-by: Richard Chang <richardycc@google.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Kalesh Singh <kaleshsingh@google.com>
Cc: Martin Liu <liumartin@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/cma.c

index 397567883a107f042fa448ae8eee1a53380c0b40..bd3772773736775ea2c9fd1d62fc62c6f02940db 100644 (file)
--- 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;