mm/cma: fix placement of trace_cma_alloc_start/finish
authorKalesh Singh <kaleshsingh@google.com>
Wed, 10 Jan 2024 01:22:33 +0000 (17:22 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 22 Feb 2024 00:00:01 +0000 (16:00 -0800)
commit51ae3f4ac5e94334ac6078145a02bc8f30e8528b
tree6c7210cc29de716f6bd18330867a291583382648
parent2597c9947b0174fcc71bdd7ab6cb49c2b4291e95
mm/cma: fix placement of trace_cma_alloc_start/finish

The current placement of trace_cma_alloc_start/finish misses the fail
cases: !cma || !cma->count || !cma->bitmap.

trace_cma_alloc_finish is also not emitted for the failure case
where bitmap_count > bitmap_maxno.

Fix these missed cases by moving the start event before the failure
checks and moving the finish event to the out label.

Link: https://lkml.kernel.org/r/20240110012234.3793639-1-kaleshsingh@google.com
Fixes: 7bc1aec5e287 ("mm: cma: add trace events for CMA alloc perf testing")
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/cma.c