Skip to contentSkip to conversation

mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start

PATCH Superseded Xiang Gao 4 participants 6 messages Aug 20, 2025 1 message not in the archive

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Xiang Gao

author
#1 lore raw

PATCH v2 1/1 mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start

From: gaoxiang17 <[email protected]>

This makes cma info more intuitive during debugging.

---
 include/trace/events/cma.h | 19 +++++++++++++------
 mm/cma.c                   |  2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)
include/trace/events/cma.h +13 -6
index 383c09f583ac..5655ac521fb5 100644
@@ -38,25 +38,32 @@ TRACE_EVENT(cma_release,
 
 TRACE_EVENT(cma_alloc_start,
 
-	TP_PROTO(const char *name, unsigned long count, unsigned int align),
+	TP_PROTO(const char *name, unsigned long request_count, unsigned long available_count,
+		unsigned long total_count, unsigned int align),
 
-	TP_ARGS(name, count, align),
+	TP_ARGS(name, request_count, available_count, total_count, align),
 
 	TP_STRUCT__entry(
 		__string(name, name)
-		__field(unsigned long, count)
+		__field(unsigned long, request_count)
+		__field(unsigned long, available_count)
+		__field(unsigned long, total_count)
 		__field(unsigned int, align)
 	),
 
 	TP_fast_assign(
 		__assign_str(name);
-		__entry->count = count;
+		__entry->count = request_count;
+		__entry->available_count = available_count;
+		__entry->total_count = total_count;
 		__entry->align = align;
 	),
 
-	TP_printk("name=%s count=%lu align=%u",
+	TP_printk("name=%s count=%lu request_count=%lu total_count=%lu align=%u",
 		  __get_str(name),
-		  __entry->count,
+		  __entry->request_count,
+		  __entry->available_count,
+		  __entry->total_count,
 		  __entry->align)
 );
 
mm/cma.c +1 -1
index 2ffa4befb99a..e56ec64d0567 100644
@@ -864,7 +864,7 @@ static struct page *__cma_alloc(struct cma *cma, unsigned long count,
 	if (!count)
 		return page;
 
-	trace_cma_alloc_start(name, count, align);
+	trace_cma_alloc_start(name, count, cma->available_count, cma->count, align);
 
 	for (r = 0; r < cma->nranges; r++) {
 		page = NULL;
Signature · 1 line
2.34.1
#2 lore raw
Quoted 35 lines · Xiang Gao

From: gaoxiang17 <[email protected]>

This makes cma info more intuitive during debugging.

---
  include/trace/events/cma.h | 19 +++++++++++++------
  mm/cma.c                   |  2 +-
  2 files changed, 14 insertions(+), 7 deletions(-)
include/trace/events/cma.h +6 -3
index 383c09f583ac..5655ac521fb5 100644
@@ -38,25 +38,32 @@ TRACE_EVENT(cma_release,
 
  TRACE_EVENT(cma_alloc_start,
 
-	TP_PROTO(const char *name, unsigned long count, unsigned int align),
+	TP_PROTO(const char *name, unsigned long request_count, unsigned long available_count,
+		unsigned long total_count, unsigned int align),
 
-	TP_ARGS(name, count, align),
+	TP_ARGS(name, request_count, available_count, total_count, align),
 
  	TP_STRUCT__entry(
  		__string(name, name)
-		__field(unsigned long, count)
+		__field(unsigned long, request_count)
+		__field(unsigned long, available_count)
+		__field(unsigned long, total_count)
  		__field(unsigned int, align)
  	),
 
  	TP_fast_assign(

include/trace/events/cma.h TRACE_EVENT(cma_release, · line 62

Quoted 10 lines
include/trace/events/cma.h +4 -2
  		__assign_str(name);
-		__entry->count = count;
+		__entry->count = request_count;
+		__entry->available_count = available_count;
+		__entry->total_count = total_count;
  		__entry->align = align;
  	),
 
-	TP_printk("name=%s count=%lu align=%u",
+	TP_printk("name=%s count=%lu request_count=%lu total_count=%lu align=%u",

"requested_count" ?

Signature · 3 lines
Cheers

David / dhildenb
#3 lore raw

Is "request count" also written in the title? The previous "count" was changed to "request_count"

________________________________
发件人: David Hildenbrand <[email protected]>
发送时间: 2025年8月20日 17:14:10
收件人: Xiang Gao; [email protected]
抄送: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; 高翔 主题: [External Mail]Re: [PATCH v2 1/1] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start

[外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给[email protected]进行反馈

Quoted 35 lines · Xiang Gao

From: gaoxiang17 <[email protected]>

This makes cma info more intuitive during debugging.

---
  include/trace/events/cma.h | 19 +++++++++++++------
  mm/cma.c                   |  2 +-
  2 files changed, 14 insertions(+), 7 deletions(-)
include/trace/events/cma.h +6 -3
index 383c09f583ac..5655ac521fb5 100644
@@ -38,25 +38,32 @@ TRACE_EVENT(cma_release,
 
  TRACE_EVENT(cma_alloc_start,
 
-     TP_PROTO(const char *name, unsigned long count, unsigned int align),
+     TP_PROTO(const char *name, unsigned long request_count, unsigned long available_count,
+             unsigned long total_count, unsigned int align),
 
-     TP_ARGS(name, count, align),
+     TP_ARGS(name, request_count, available_count, total_count, align),
 
      TP_STRUCT__entry(
              __string(name, name)
-             __field(unsigned long, count)
+             __field(unsigned long, request_count)
+             __field(unsigned long, available_count)
+             __field(unsigned long, total_count)
              __field(unsigned int, align)
      ),
 
      TP_fast_assign(

include/trace/events/cma.h TRACE_EVENT(cma_release, · line 62

Quoted 10 lines
include/trace/events/cma.h +4 -2
              __assign_str(name);
-             __entry->count = count;
+             __entry->count = request_count;
+             __entry->available_count = available_count;
+             __entry->total_count = total_count;
              __entry->align = align;
      ),
 
-     TP_printk("name=%s count=%lu align=%u",
+     TP_printk("name=%s count=%lu request_count=%lu total_count=%lu align=%u",

"requested_count" ?

--
Cheers

David / dhildenb

#4 lore raw
Quoted 1 line · 高翔

Is "request count" also written in the title? The previous "count" was changed to "request_count"

Right, "cma->available_count" gets translated to "request_count". Maybe that's the issue here?

PLEASE

Can you (Xiang Gao) test the patch before sending it?

Nobody has the capacity here to go through 20 iterations of such a trivial change.

Signature · 3 lines
Cheers

David / dhildenb
#5 lore raw

sorry, I changed it.

________________________________
发件人: David Hildenbrand <[email protected]>
发送时间: 2025年8月20日 17:30:57
收件人: 高翔; Xiang Gao; [email protected]
抄送: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] 主题: Re: 答复: [External Mail]Re: [PATCH v2 1/1] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start

[外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给[email protected]进行反馈

Quoted 2 lines · 高翔

Is "request count" also written in the title? The previous "count" was changed to "request_count"

Right, "cma->available_count" gets translated to "request_count". Maybe that's the issue here?

PLEASE

Can you (Xiang Gao) test the patch before sending it?

Nobody has the capacity here to go through 20 iterations of such a trivial change.

--
Cheers

David / dhildenb

#6 lore raw
In reply to Xiang Gao
kernel test robot noticed the following build errors:

Hi Xiang,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]

url:    https://github.com/intel-lab-lkp/linux/commits/Xiang-Gao/mm-cma-add-available-count-and-total-count-to-trace_cma_alloc_start/20250820-105438
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/d30f91137e3a296152463ea65474e1ca56f4eda3.1755654367.git.gaoxiang17%40xiaomi.com
patch subject: [PATCH v2 1/1] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20250821/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250821/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from mm/cma.c:31:
In file included from include/trace/events/cma.h:138:
In file included from include/trace/define_trace.h:132:
In file included from include/trace/trace_events.h:468:

>> include/trace/events/cma.h:56:12: error: no member named 'count' in 'struct trace_event_raw_cma_alloc_start'
      56 |                 __entry->count = request_count;
         |                 ~~~~~~~  ^
   include/trace/stages/stage6_event_callback.h:133:33: note: expanded from macro 'TP_fast_assign'
     133 | #define TP_fast_assign(args...) args
         |                                 ^~~~
   include/trace/trace_events.h:44:16: note: expanded from macro 'TRACE_EVENT'
      44 |                              PARAMS(assign),                   \
         |                                     ^~~~~~
   include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS'
     139 | #define PARAMS(args...) args
         |                         ^~~~
   include/trace/trace_events.h:435:16: note: expanded from macro 'DECLARE_EVENT_CLASS'
     435 |                       PARAMS(assign), PARAMS(print))                    \
         |                              ^~~~~~
   include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS'
     139 | #define PARAMS(args...) args
         |                         ^~~~
   include/trace/trace_events.h:427:4: note: expanded from macro '\
   __DECLARE_EVENT_CLASS'
     427 |         { assign; }                                                     \
         |           ^~~~~~
   In file included from mm/cma.c:31:
   In file included from include/trace/events/cma.h:138:
   In file included from include/trace/define_trace.h:133:
   In file included from include/trace/perf.h:110:
>> include/trace/events/cma.h:56:12: error: no member named 'count' in 'struct trace_event_raw_cma_alloc_start'
      56 |                 __entry->count = request_count;
         |                 ~~~~~~~  ^
   include/trace/stages/stage6_event_callback.h:133:33: note: expanded from macro 'TP_fast_assign'
     133 | #define TP_fast_assign(args...) args
         |                                 ^~~~
   include/trace/trace_events.h:44:16: note: expanded from macro 'TRACE_EVENT'
      44 |                              PARAMS(assign),                   \
         |                                     ^~~~~~
   include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS'
     139 | #define PARAMS(args...) args
         |                         ^~~~
   include/trace/perf.h:67:16: note: expanded from macro 'DECLARE_EVENT_CLASS'
      67 |                       PARAMS(assign), PARAMS(print))                    \
         |                              ^~~~~~
   include/linux/tracepoint.h:139:25: note: expanded from macro 'PARAMS'
     139 | #define PARAMS(args...) args
         |                         ^~~~
   include/trace/perf.h:51:4: note: expanded from macro '\
   __DECLARE_EVENT_CLASS'
      51 |         { assign; }                                                     \
         |           ^~~~~~

2 errors generated.

vim +56 include/trace/events/cma.h

    40	
    41		TP_PROTO(const char *name, unsigned long request_count, unsigned long available_count,
    42			unsigned long total_count, unsigned int align),
    43	
    44		TP_ARGS(name, request_count, available_count, total_count, align),
    45	
    46		TP_STRUCT__entry(
    47			__string(name, name)
    48			__field(unsigned long, request_count)
    49			__field(unsigned long, available_count)
    50			__field(unsigned long, total_count)
    51			__field(unsigned int, align)
    52		),
    53	
    54		TP_fast_assign(
    55			__assign_str(name);
  > 56			__entry->count = request_count;
    57			__entry->available_count = available_count;
    58			__entry->total_count = total_count;
    59			__entry->align = align;
    60		),
    61	
    62		TP_printk("name=%s count=%lu request_count=%lu total_count=%lu align=%u",
    63			  __get_str(name),
    64			  __entry->request_count,
    65			  __entry->available_count,
    66			  __entry->total_count,
    67			  __entry->align)
    68	);
    69	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki