[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y6HSutM8pmoKxQWp@alley>
Date: Tue, 20 Dec 2022 16:20:26 +0100
From: Petr Mladek <pmladek@...e.com>
To: Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc: Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Roman Gushchin <roman.gushchin@...ux.dev>,
HORIGUCHI NAOYA(堀口 直也)
<naoya.horiguchi@....com>, Joe Perches <joe@...ches.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Matthew WilCox <willy@...radead.org>,
David Hildenbrand <david@...hat.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC v3 3/4] mm, printk: introduce new format %pGt for page_type
On Sun 2022-12-18 19:19:00, Hyeonggon Yoo wrote:
> %pGp format is used 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.
>
> Note that the sense of bits are different in page_type. if page_type is
> 0xffffffff, no flags are set. if PG_slab (0x00100000) flag is set,
> page_type is 0xffefffff. Clearing a bit means we set the bit.
>
> Bits in page_type are inverted when printing page type names.
>
> --- a/Documentation/core-api/printk-formats.rst
> +++ b/Documentation/core-api/printk-formats.rst
> @@ -575,12 +575,13 @@ The field width is passed by value, the bitmap is passed by reference.
> Helper macros cpumask_pr_args() and nodemask_pr_args() are available to ease
> printing cpumask and nodemask.
>
> -Flags bitfields such as page flags, gfp_flags
> +Flags bitfields such as page flags, page_type, gfp_flags
> ---------------------------------------------
Please, underline the entire title. Otherwise, "make htmldoc"
complains ;-)
/prace/kernel/linux/Documentation/core-api/printk-formats.rst:579: WARNING: Title underline too short.
Flags bitfields such as page flags, page_type, gfp_flags
>
> ::
>
> %pGp 0x17ffffc0002036(referenced|uptodate|lru|active|private|node=0|zone=2|lastcpupid=0x1fffff)
> + %pGt 0xffefffff(slab)
> %pGg GFP_USER|GFP_DMA32|GFP_NOWARN
> %pGv read|exec|mayread|maywrite|mayexec|denywrite
>
Please, explain this also in the paragraph below these examples.
I would personally refactor it to an itemized list, something like:
<proposal>
For printing flags bitfields as a collection of symbolic constants that
would construct the value. The type of flags is given by the third
character. Currently supported are:
- p - [p]age flags, expects value of type (``unsigned long *``)
- t - page [t]ype, expects value of type (``unsigned int *``)
- v - [v]ma_flags, expects value of type (``unsigned long *``)
- g - [g]fp_flags, expects value of type (``gfp_t *``)
The flag names and print order depends on the particular type.
</proposal>
Rant:
Sigh, it looks a bit error prone when similar pointer modifiers
expects pointers to different types. I wish there was a way how
to check the passed pointer type at compilation time. But it
is generic problem with these %p* modifiers.
Otherwise the patch looks fine for the vsprinf side.
Best Regards,
Petr
Powered by blists - more mailing lists