Re: [RFC v2 3/3] mm, printk: introduce new format %pGt for page_type

From: Hyeonggon Yoo
Date: Wed Nov 09 2022 - 01:14:28 EST


On Sun, Nov 06, 2022 at 10:04:25AM -0800, Joe Perches wrote:
> On Sun, 2022-11-06 at 23:03 +0900, Hyeonggon Yoo wrote:
> > dump_page() uses %pGp format to print 'flags' field of struct page.
> > As some page flags (e.g. PG_buddy, see page-flags.h for more details)
> > are set in page_type field, introduce %pGt format which provides
> > human readable output of page_type. And use it in dump_page().
> []
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> []
> > @@ -2056,6 +2056,28 @@ char *format_page_flags(char *buf, char *end, unsigned long flags)
> > return buf;
> > }
> >
> > +static

Thanks for looking at this.

>
> noinline_for_stack ?

May I ask why,
Does it have issues related to stack consumption?
To Be Honest I'm a bit unsure what is purpose of this attribute.

> > +char *format_page_type(char *buf, char *end, unsigned int page_type)
> > +{
> > + if (!(page_type & PAGE_TYPE_BASE))
> > + return string(buf, end, "no type for user-mapped page", default_str_spec);
>
> Might be better with something like '%pGt: no type..."

Will try something like "0x32()" when it has no type because it is
mapped to userspace.

--
Thanks,
Hyeonggon