From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Ye Bin <yebin@huaweicloud.com>,
harry@kernel.org, hao.li@linux.dev, cl@gentwo.org,
rientjes@google.com, roman.gushchin@linux.dev,
linux-mm@kvack.org
Cc: yebin10@huawei.com
Subject: Re: [PATCH] mm: page_alloc: add nid to mm_page_alloc tracepoint
Date: Fri, 13 Nov 2026 09:48:00 +0100 [thread overview]
Message-ID: <ab518ee3-ba4e-4c36-afeb-5943a3192ea7@kernel.org> (raw)
In-Reply-To: <20261113062007.95040-1-yebin@huaweicloud.com>
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))
> );
>
prev parent reply other threads:[~2026-11-13 8:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab518ee3-ba4e-4c36-afeb-5943a3192ea7@kernel.org \
--to=vbabka@kernel.org \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=yebin10@huawei.com \
--cc=yebin@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox