* [PATCH] mm: page_alloc: add nid to mm_page_alloc tracepoint
@ 2026-11-13 6:20 Ye Bin
2026-11-13 8:48 ` Vlastimil Babka (SUSE)
0 siblings, 1 reply; 2+ messages in thread
From: Ye Bin @ 2026-11-13 6:20 UTC (permalink / raw)
To: vbabka, harry, hao.li, cl, rientjes, roman.gushchin, linux-mm; +Cc: yebin10
From: Ye Bin <yebin10@huawei.com>
Add the NUMA node id to the mm_page_alloc trace event so that page
allocations can be attributed to a specific node directly from the
trace, without having to look up the pfn separately.
The nid is derived from the allocated page, or set to -1 when no page
is available (e.g. failed allocations).
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
include/trace/events/kmem.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index cd7920c81f85..8bf4e992d8bb 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -189,6 +189,7 @@ TRACE_EVENT(mm_page_alloc,
__field( unsigned int, order )
__field( unsigned long, gfp_flags )
__field( int, migratetype )
+ __field( int, nid )
),
TP_fast_assign(
@@ -196,13 +197,15 @@ TRACE_EVENT(mm_page_alloc,
__entry->order = order;
__entry->gfp_flags = (__force unsigned long)gfp_flags;
__entry->migratetype = migratetype;
+ __entry->nid = page ? page_to_nid(page) : -1;
),
- TP_printk("page=%p pfn=0x%lx order=%d migratetype=%d gfp_flags=%s",
+ TP_printk("page=%p pfn=0x%lx order=%d migratetype=%d nid=%d gfp_flags=%s",
__entry->pfn != -1UL ? pfn_to_page(__entry->pfn) : NULL,
__entry->pfn != -1UL ? __entry->pfn : 0,
__entry->order,
__entry->migratetype,
+ __entry->nid,
show_gfp_flags(__entry->gfp_flags))
);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: page_alloc: add nid to mm_page_alloc tracepoint
2026-11-13 6:20 [PATCH] mm: page_alloc: add nid to mm_page_alloc tracepoint Ye Bin
@ 2026-11-13 8:48 ` Vlastimil Babka (SUSE)
0 siblings, 0 replies; 2+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-11-13 8:48 UTC (permalink / raw)
To: Ye Bin, harry, hao.li, cl, rientjes, roman.gushchin, linux-mm; +Cc: yebin10
On 11/13/26 07:20, Ye Bin wrote:
> From: Ye Bin <yebin10@huawei.com>
>
> Add the NUMA node id to the mm_page_alloc trace event so that page
> allocations can be attributed to a specific node directly from the
> trace, without having to look up the pfn separately.
But is it the right tradeoff? Trace data should be as minimal as possible
for cpu and memory purposes. Anything extra that can be achieved by
postprocessing is better done that way. Matching pfn to node using
/proc/zoneinfo is simple.
> The nid is derived from the allocated page, or set to -1 when no page
> is available (e.g. failed allocations).
>
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
> include/trace/events/kmem.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
> index cd7920c81f85..8bf4e992d8bb 100644
> --- a/include/trace/events/kmem.h
> +++ b/include/trace/events/kmem.h
> @@ -189,6 +189,7 @@ TRACE_EVENT(mm_page_alloc,
> __field( unsigned int, order )
> __field( unsigned long, gfp_flags )
> __field( int, migratetype )
> + __field( int, nid )
> ),
>
> TP_fast_assign(
> @@ -196,13 +197,15 @@ TRACE_EVENT(mm_page_alloc,
> __entry->order = order;
> __entry->gfp_flags = (__force unsigned long)gfp_flags;
> __entry->migratetype = migratetype;
> + __entry->nid = page ? page_to_nid(page) : -1;
> ),
>
> - TP_printk("page=%p pfn=0x%lx order=%d migratetype=%d gfp_flags=%s",
> + TP_printk("page=%p pfn=0x%lx order=%d migratetype=%d nid=%d gfp_flags=%s",
> __entry->pfn != -1UL ? pfn_to_page(__entry->pfn) : NULL,
> __entry->pfn != -1UL ? __entry->pfn : 0,
> __entry->order,
> __entry->migratetype,
> + __entry->nid,
> show_gfp_flags(__entry->gfp_flags))
> );
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-13 8:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 6:20 [PATCH] mm: page_alloc: add nid to mm_page_alloc tracepoint Ye Bin
2026-11-13 8:48 ` Vlastimil Babka (SUSE)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox