linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Naoya Horiguchi <naoya.horiguchi@nec.com>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Matthew Wilcox <willy@infradead.org>,
	Minchan Kim <minchan@kernel.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Hugh Dickins <hughd@google.com>,
	Muchun Song <songmuchun@bytedance.com>,
	David Hildenbrand <david@redhat.com>,
	Hyeonggon Yoo <42.hyeyoo@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Marco Elver <elver@google.com>,
	Vasily Averin <vasily.averin@linux.dev>,
	NeilBrown <neilb@suse.de>
Subject: [RFC v2 2/3] mm: introduce show_page_types() to provide human-readable page_type
Date: Sun,  6 Nov 2022 23:03:54 +0900	[thread overview]
Message-ID: <20221106140355.294845-3-42.hyeyoo@gmail.com> (raw)
In-Reply-To: <20221106140355.294845-1-42.hyeyoo@gmail.com>

Some page flags are not actually set in 'flags' field. To provide
better understanding of tracepoint output, introduce show_page_types()
that shows page flags from page_type.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Marco Elver <elver@google.com>
Cc: Vasily Averin <vasily.averin@linux.dev>
Cc: NeilBrown <neilb@suse.de>
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
---
 include/trace/events/mmflags.h  | 12 ++++++++++++
 include/trace/events/page_ref.h | 10 ++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h
index 72c11a16f771..a8dfb98a4dd6 100644
--- a/include/trace/events/mmflags.h
+++ b/include/trace/events/mmflags.h
@@ -136,6 +136,18 @@ IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison")
 	__def_pageflag_names						\
 	) : "none"
 
+#define __def_pagetype_names						\
+	{PG_slab,			"slab"		},		\
+	{PG_offline,			"offline"	},		\
+	{PG_guard,			"guard"		},		\
+	{PG_table,			"table"		},		\
+	{PG_buddy,			"buddy"		}
+
+#define show_page_types(page_type)					\
+	page_type_has_type(page_type) ?					\
+		__print_flags((~page_type), "|", __def_pagetype_names)	\
+	: "none"
+
 #if defined(CONFIG_X86)
 #define __VM_ARCH_SPECIFIC_1 {VM_PAT,     "pat"           }
 #elif defined(CONFIG_PPC)
diff --git a/include/trace/events/page_ref.h b/include/trace/events/page_ref.h
index 8a99c1cd417b..b00d23e90e93 100644
--- a/include/trace/events/page_ref.h
+++ b/include/trace/events/page_ref.h
@@ -21,6 +21,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template,
 		__field(unsigned long, flags)
 		__field(int, count)
 		__field(int, mapcount)
+		__field(unsigned int, page_type)
 		__field(void *, mapping)
 		__field(int, mt)
 		__field(int, val)
@@ -31,14 +32,16 @@ DECLARE_EVENT_CLASS(page_ref_mod_template,
 		__entry->flags = page->flags;
 		__entry->count = page_ref_count(page);
 		__entry->mapcount = page_mapcount(page);
+		__entry->page_type = page->page_type;
 		__entry->mapping = page->mapping;
 		__entry->mt = get_pageblock_migratetype(page);
 		__entry->val = v;
 	),
 
-	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d",
+	TP_printk("pfn=0x%lx flags=%s page_type=%s count=%d mapcount=%d mapping=%p mt=%d val=%d",
 		__entry->pfn,
 		show_page_flags(__entry->flags & PAGEFLAGS_MASK),
+		show_page_types(__entry->page_type & PAGE_TYPE_MASK),
 		__entry->count,
 		__entry->mapcount, __entry->mapping, __entry->mt,
 		__entry->val)
@@ -69,6 +72,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template,
 		__field(unsigned long, flags)
 		__field(int, count)
 		__field(int, mapcount)
+		__field(unsigned int, page_type)
 		__field(void *, mapping)
 		__field(int, mt)
 		__field(int, val)
@@ -80,15 +84,17 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template,
 		__entry->flags = page->flags;
 		__entry->count = page_ref_count(page);
 		__entry->mapcount = page_mapcount(page);
+		__entry->page_type = page->page_type;
 		__entry->mapping = page->mapping;
 		__entry->mt = get_pageblock_migratetype(page);
 		__entry->val = v;
 		__entry->ret = ret;
 	),
 
-	TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d",
+	TP_printk("pfn=0x%lx flags=%s page_type=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d",
 		__entry->pfn,
 		show_page_flags(__entry->flags & PAGEFLAGS_MASK),
+		show_page_types(__entry->page_type & PAGE_TYPE_MASK),
 		__entry->count,
 		__entry->mapcount, __entry->mapping, __entry->mt,
 		__entry->val, __entry->ret)
-- 
2.32.0



  parent reply	other threads:[~2022-11-06 14:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06 14:03 [RFC v2 0/3] move PG_slab to page_type Hyeonggon Yoo
2022-11-06 14:03 ` [RFC v2 1/3] mm: move PG_slab flag " Hyeonggon Yoo
2022-11-08  5:39   ` HORIGUCHI NAOYA(堀口 直也)
2022-11-09  5:45     ` Hyeonggon Yoo
2022-11-06 14:03 ` Hyeonggon Yoo [this message]
2022-11-06 18:23   ` [RFC v2 2/3] mm: introduce show_page_types() to provide human-readable page_type Steven Rostedt
2022-11-09  6:19     ` Hyeonggon Yoo
2022-11-06 14:03 ` [RFC v2 3/3] mm, printk: introduce new format %pGt for page_type Hyeonggon Yoo
2022-11-06 18:04   ` Joe Perches
2022-11-09  6:14     ` Hyeonggon Yoo
2022-11-09  8:13       ` Petr Mladek
2022-11-07 11:18   ` Andy Shevchenko
2022-11-07 14:20     ` Petr Mladek
2022-11-07 14:41       ` Andy Shevchenko
2022-11-09  6:04       ` Hyeonggon Yoo

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=20221106140355.294845-3-42.hyeyoo@gmail.com \
    --to=42.hyeyoo@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=cl@linux.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=elver@google.com \
    --cc=hughd@google.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhiramat@kernel.org \
    --cc=minchan@kernel.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=neilb@suse.de \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=songmuchun@bytedance.com \
    --cc=vasily.averin@linux.dev \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).