All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-mm@kvack.org, 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>,
	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: Re: [RFC v2 2/3] mm: introduce show_page_types() to provide human-readable page_type
Date: Wed, 9 Nov 2022 15:19:42 +0900	[thread overview]
Message-ID: <Y2tGfggo2QqwJTp6@hyeyoo> (raw)
In-Reply-To: <20221106132315.27f45759@rorschach.local.home>

On Sun, Nov 06, 2022 at 01:23:15PM -0500, Steven Rostedt wrote:
> On Sun,  6 Nov 2022 23:03:54 +0900
> Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote:
> 
> > 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)
> 
> Be careful were you add int fields for 64 bit machines.
> 
> The above is going to add 4 bytes of nothing in the ring buffer for
> each event. Please try to keep ints together by 2s, especially between
> long and pointer fields.

Oh, I wasn't aware of it. I think I can use the field 'mapcount' to
represent both mapcount and page_type as they have same offset and size
within the structure.

Just wondering where this constraint came from...

> 
> >  		__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)
> 
> Here too.
> 
> -- Steve
> 
> >  		__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)
> 

-- 
Thanks,
Hyeonggon


  reply	other threads:[~2022-11-09  6:20 UTC|newest]

Thread overview: 16+ 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-06 16:36   ` kernel test robot
2022-11-08  5:39   ` HORIGUCHI NAOYA(堀口 直也)
2022-11-09  5:45     ` Hyeonggon Yoo
2022-11-06 14:03 ` [RFC v2 2/3] mm: introduce show_page_types() to provide human-readable page_type Hyeonggon Yoo
2022-11-06 18:23   ` Steven Rostedt
2022-11-09  6:19     ` Hyeonggon Yoo [this message]
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=Y2tGfggo2QqwJTp6@hyeyoo \
    --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 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.