All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ye Bin <yebin@huaweicloud.com>
To: vbabka@kernel.org, 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: [PATCH] mm: page_alloc: add nid to mm_page_alloc tracepoint
Date: Fri, 13 Nov 2026 14:20:07 +0800	[thread overview]
Message-ID: <20261113062007.95040-1-yebin@huaweicloud.com> (raw)

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



             reply	other threads:[~2026-11-13  6:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  6:20 Ye Bin [this message]
2026-11-13  8:48 ` [PATCH] mm: page_alloc: add nid to mm_page_alloc tracepoint Vlastimil Babka (SUSE)

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=20261113062007.95040-1-yebin@huaweicloud.com \
    --to=yebin@huaweicloud.com \
    --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=vbabka@kernel.org \
    --cc=yebin10@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.