linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start
@ 2025-08-19 13:48 Xiang Gao
  2025-08-19 19:17 ` David Hildenbrand
  2025-08-20  0:31 ` Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: Xiang Gao @ 2025-08-19 13:48 UTC (permalink / raw)
  To: akpm, david
  Cc: lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
	linux-mm, linux-kernel, gaoxiang17

From: gaoxiang17 <gaoxiang17@xiaomi.com>

This makes cma info more intuitive during debugging.

Signed-off-by: gaoxiang17 <gaoxiang17@xiaomi.com>
---
 include/trace/events/cma.h | 17 ++++++++++++-----
 mm/cma.c                   |  2 +-
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/include/trace/events/cma.h b/include/trace/events/cma.h
index 383c09f583ac..fbe70008ffc7 100644
--- a/include/trace/events/cma.h
+++ b/include/trace/events/cma.h
@@ -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",
 		  __get_str(name),
-		  __entry->count,
+		  __entry->request_count,
+		  __entry->available_count,
+		  __entry->total_count,
 		  __entry->align)
 );
 
diff --git a/mm/cma.c b/mm/cma.c
index 2ffa4befb99a..e56ec64d0567 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start
  2025-08-19 13:48 [PATCH] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start Xiang Gao
@ 2025-08-19 19:17 ` David Hildenbrand
  2025-08-20  0:31 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2025-08-19 19:17 UTC (permalink / raw)
  To: Xiang Gao, akpm
  Cc: lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
	linux-mm, linux-kernel, gaoxiang17

On 19.08.25 15:48, Xiang Gao wrote:
> From: gaoxiang17 <gaoxiang17@xiaomi.com>
> 
> This makes cma info more intuitive during debugging.
> 
> Signed-off-by: gaoxiang17 <gaoxiang17@xiaomi.com>
> ---

For the next time: you should have indicated that this is v2 ([PATCH 
v2]) and briefly described under the "---" the changes between v1 and v2.

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

-- 
Cheers

David / dhildenb


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start
  2025-08-19 13:48 [PATCH] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start Xiang Gao
  2025-08-19 19:17 ` David Hildenbrand
@ 2025-08-20  0:31 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2025-08-20  0:31 UTC (permalink / raw)
  To: Xiang Gao
  Cc: david, lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb,
	mhocko, linux-mm, linux-kernel, gaoxiang17

On Tue, 19 Aug 2025 21:48:17 +0800 Xiang Gao <gxxa03070307@gmail.com> wrote:

> From: gaoxiang17 <gaoxiang17@xiaomi.com>
> 
> This makes cma info more intuitive during debugging.
> 
> ...
>
> --- a/include/trace/events/cma.h
> +++ b/include/trace/events/cma.h
>
> ...
>
>  	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",
>  		  __get_str(name),
> -		  __entry->count,
> +		  __entry->request_count,
> +		  __entry->available_count,
> +		  __entry->total_count,
>  		  __entry->align)

adds three args to the printk but didn't add their conversions to the
printk control string?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-20  0:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 13:48 [PATCH] mm/cma: add 'available count' and 'total count' to trace_cma_alloc_start Xiang Gao
2025-08-19 19:17 ` David Hildenbrand
2025-08-20  0:31 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).