Skip to contentSkip to conversation

mm/cma: pairing the trace_cma_alloc_start/finish

PATCH Applied Richard Chang 2 participants 2 messages Jun 5, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/cma: pairing the trace_cma_alloc_start/finish

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.

---
 mm/cma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/cma.c +2 -2
index 397567883a10..bd3772773736 100644
@@ -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;
 
Signature · 1 line
2.50.0.rc0.604.gd4ff7b7c86-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Richard Chang

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.

---
  mm/cma.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
mm/cma.c +0 -2
index 397567883a10..bd3772773736 100644
@@ -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;
 

mm/cma.c static struct page *__cma_alloc(struct cma *cma, unsigned long count, · line 870

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

David / dhildenb