All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mm: improve the output of print_page_info()
@ 2021-01-15  6:13 Yafang Shao
  2021-01-15  6:13 ` [PATCH 1/2] mm, slub: use pGp to print page flags Yafang Shao
  2021-01-15  6:13 ` [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better Yafang Shao
  0 siblings, 2 replies; 9+ messages in thread
From: Yafang Shao @ 2021-01-15  6:13 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, willy, hannes,
	mhocko, david, osalvador, linmiaohe, steven.price, guro,
	alexander.h.duyck, ying.huang
  Cc: linux-mm, Yafang Shao

Before that patchset, the output of print_page_info() is
[ 6155.716018] INFO: Slab 0x000000004027dd4f objects=33 used=3 fp=0x000000008cd1579c flags=0x17ffffc0010200

While after it, the output is
[ 8843.757770] INFO: Slab 0x00000000f0e98335 objects=33 used=3 fp=0x00000000b643c7d8 flags=0x10200(slab|head)

The new one is more friendly and human readable.

Yafang Shao (2):
  mm, slub: use pGp to print page flags
  mm: introduce PAGE_FLAGS() to make output of page flags better

 include/linux/page-flags.h | 2 ++
 mm/slub.c                  | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] mm, slub: use pGp to print page flags
  2021-01-15  6:13 [PATCH 0/2] mm: improve the output of print_page_info() Yafang Shao
@ 2021-01-15  6:13 ` Yafang Shao
  2021-01-15  8:46   ` David Hildenbrand
  2021-01-15  6:13 ` [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better Yafang Shao
  1 sibling, 1 reply; 9+ messages in thread
From: Yafang Shao @ 2021-01-15  6:13 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, willy, hannes,
	mhocko, david, osalvador, linmiaohe, steven.price, guro,
	alexander.h.duyck, ying.huang
  Cc: linux-mm, Yafang Shao

As pGp has been already introduced in printk, we'd better use it to make
the output human readable.

Before this change, the output is,
[ 6155.716018] INFO: Slab 0x000000004027dd4f objects=33 used=3 fp=0x000000008cd1579c flags=0x17ffffc0010200

While after this change, the output is,
[ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head)

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 mm/slub.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index dc5b42e..901a45a 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -641,8 +641,9 @@ void print_tracking(struct kmem_cache *s, void *object)
 
 static void print_page_info(struct page *page)
 {
-	pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=0x%04lx\n",
-	       page, page->objects, page->inuse, page->freelist, page->flags);
+	pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=%#lx(%pGp)\n",
+	       page, page->objects, page->inuse, page->freelist,
+	       page->flags, &page->flags);
 
 }
 
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better
  2021-01-15  6:13 [PATCH 0/2] mm: improve the output of print_page_info() Yafang Shao
  2021-01-15  6:13 ` [PATCH 1/2] mm, slub: use pGp to print page flags Yafang Shao
@ 2021-01-15  6:13 ` Yafang Shao
  2021-01-15  8:39   ` David Hildenbrand
  1 sibling, 1 reply; 9+ messages in thread
From: Yafang Shao @ 2021-01-15  6:13 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, willy, hannes,
	mhocko, david, osalvador, linmiaohe, steven.price, guro,
	alexander.h.duyck, ying.huang
  Cc: linux-mm, Yafang Shao

There're totally __NR_PAGEFLAGS page flags, but the type of page->flags is
unsigned long, that makes the value of page->flags a little misleading when
it is printed to the user. We'd better print the real pages flags, instead
of the whole 64bits including the random values in the useless high bits.

There're two choices to achieve that, one of which is clear the useless
high bits when we initlize the page->flags, the other is don't print the
high bits when it is showed to the user. The latter one is better because
it is in the slow path and the performance won't be impacted.

Before that change, the output is,
[ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head)

After that change, the output is,
[ 8843.757770] INFO: Slab 0x00000000f0e98335 objects=33 used=3 fp=0x00000000b643c7d8 flags=0x10200(slab|head)

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 include/linux/page-flags.h | 2 ++
 mm/slub.c                  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index ec5d029..db5c017 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -175,6 +175,8 @@ enum pageflags {
 	PG_reported = PG_uptodate,
 };
 
+#define PAGE_FLAGS(flags) (flags & ((1 << __NR_PAGEFLAGS) - 1))
+
 #ifndef __GENERATING_BOUNDS_H
 
 struct page;	/* forward declaration */
diff --git a/mm/slub.c b/mm/slub.c
index 901a45a..a93a03c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -643,7 +643,7 @@ static void print_page_info(struct page *page)
 {
 	pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=%#lx(%pGp)\n",
 	       page, page->objects, page->inuse, page->freelist,
-	       page->flags, &page->flags);
+	       PAGE_FLAGS(page->flags), &page->flags);
 
 }
 
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better
  2021-01-15  6:13 ` [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better Yafang Shao
@ 2021-01-15  8:39   ` David Hildenbrand
  2021-01-15 10:10     ` Yafang Shao
  0 siblings, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2021-01-15  8:39 UTC (permalink / raw)
  To: Yafang Shao, cl, penberg, rientjes, iamjoonsoo.kim, akpm, willy,
	hannes, mhocko, osalvador, linmiaohe, steven.price, guro,
	alexander.h.duyck, ying.huang
  Cc: linux-mm

On 15.01.21 07:13, Yafang Shao wrote:
> There're totally __NR_PAGEFLAGS page flags, but the type of page->flags is
> unsigned long, that makes the value of page->flags a little misleading when
> it is printed to the user. We'd better print the real pages flags, instead
> of the whole 64bits including the random values in the useless high bits.

No, these are *not* random values. They include the nid, zid, and
section_nr - which are helpful to have at hand when debugging, or
detecting that something might be messed up there.

> 
> There're two choices to achieve that, one of which is clear the useless

Again, not useless.

> high bits when we initlize the page->flags, the other is don't print the
> high bits when it is showed to the user. The latter one is better because
> it is in the slow path and the performance won't be impacted.
> 
> Before that change, the output is,
> [ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head)
> 
> After that change, the output is,
> [ 8843.757770] INFO: Slab 0x00000000f0e98335 objects=33 used=3 fp=0x00000000b643c7d8 flags=0x10200(slab|head)
> 

Nack to the current approach. If you're going to strip this information,
you should expose it differently. E.g., printing page_zonenum() or
page_to_nid(). But still, then we might lose valuable information of
bits stored in there that shouldn't have been set.

> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> ---
>  include/linux/page-flags.h | 2 ++
>  mm/slub.c                  | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index ec5d029..db5c017 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -175,6 +175,8 @@ enum pageflags {
>  	PG_reported = PG_uptodate,
>  };
>  
> +#define PAGE_FLAGS(flags) (flags & ((1 << __NR_PAGEFLAGS) - 1))
> +
>  #ifndef __GENERATING_BOUNDS_H
>  
>  struct page;	/* forward declaration */
> diff --git a/mm/slub.c b/mm/slub.c
> index 901a45a..a93a03c 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -643,7 +643,7 @@ static void print_page_info(struct page *page)
>  {
>  	pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=%#lx(%pGp)\n",
>  	       page, page->objects, page->inuse, page->freelist,
> -	       page->flags, &page->flags);
> +	       PAGE_FLAGS(page->flags), &page->flags);
>  
>  }
>  
> 


-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] mm, slub: use pGp to print page flags
  2021-01-15  6:13 ` [PATCH 1/2] mm, slub: use pGp to print page flags Yafang Shao
@ 2021-01-15  8:46   ` David Hildenbrand
  2021-01-15 10:14     ` Yafang Shao
  0 siblings, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2021-01-15  8:46 UTC (permalink / raw)
  To: Yafang Shao, cl, penberg, rientjes, iamjoonsoo.kim, akpm, willy,
	hannes, mhocko, osalvador, linmiaohe, steven.price, guro,
	alexander.h.duyck, ying.huang
  Cc: linux-mm

On 15.01.21 07:13, Yafang Shao wrote:
> As pGp has been already introduced in printk, we'd better use it to make
> the output human readable.
> 
> Before this change, the output is,
> [ 6155.716018] INFO: Slab 0x000000004027dd4f objects=33 used=3 fp=0x000000008cd1579c flags=0x17ffffc0010200
> 
> While after this change, the output is,
> [ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head)
> 
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> ---
>  mm/slub.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index dc5b42e..901a45a 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -641,8 +641,9 @@ void print_tracking(struct kmem_cache *s, void *object)
>  
>  static void print_page_info(struct page *page)
>  {
> -	pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=0x%04lx\n",
> -	       page, page->objects, page->inuse, page->freelist, page->flags);
> +	pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=%#lx(%pGp)\n",
> +	       page, page->objects, page->inuse, page->freelist,
> +	       page->flags, &page->flags);
>  
>  }
>  
> 

Sounds helpful to me.

"pr_err" combined with "INFO" looks a little weird - "Oh my, something
serious just happened!!!! - but, hey, just for your information ... " :)

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better
  2021-01-15  8:39   ` David Hildenbrand
@ 2021-01-15 10:10     ` Yafang Shao
  2021-01-15 10:15       ` David Hildenbrand
  0 siblings, 1 reply; 9+ messages in thread
From: Yafang Shao @ 2021-01-15 10:10 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Christoph Lameter, penberg, David Rientjes, iamjoonsoo.kim,
	Andrew Morton, Matthew Wilcox, Johannes Weiner, Michal Hocko,
	osalvador, linmiaohe, steven.price, Roman Gushchin, Huang, Ying,
	Linux MM

On Fri, Jan 15, 2021 at 4:39 PM David Hildenbrand <david@redhat.com> wrote:
>
> On 15.01.21 07:13, Yafang Shao wrote:
> > There're totally __NR_PAGEFLAGS page flags, but the type of page->flags is
> > unsigned long, that makes the value of page->flags a little misleading when
> > it is printed to the user. We'd better print the real pages flags, instead
> > of the whole 64bits including the random values in the useless high bits.
>
> No, these are *not* random values. They include the nid, zid, and
> section_nr - which are helpful to have at hand when debugging, or
> detecting that something might be messed up there.
>

Thanks for the explanation. I just noticed the page-flags layout in
page-flags-layout.h.

> >
> > There're two choices to achieve that, one of which is clear the useless
>
> Again, not useless.
>
> > high bits when we initlize the page->flags, the other is don't print the
> > high bits when it is showed to the user. The latter one is better because
> > it is in the slow path and the performance won't be impacted.
> >
> > Before that change, the output is,
> > [ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head)
> >
> > After that change, the output is,
> > [ 8843.757770] INFO: Slab 0x00000000f0e98335 objects=33 used=3 fp=0x00000000b643c7d8 flags=0x10200(slab|head)
> >
>
> Nack to the current approach. If you're going to strip this information,
> you should expose it differently. E.g., printing page_zonenum() or
> page_to_nid(). But still, then we might lose valuable information of
> bits stored in there that shouldn't have been set.
>

How about changing the implementation of pGp in printk() ?
In the new implementation of pGp we can dump the full information of
page->flags, rather than the flag's name only.

For example,
0xXXXXXXXX(node n, nid n, ..., slab|head)

That will make it easier to understand, as it is not easy to look into
the detail of page-flags layout.

> > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > ---
> >  include/linux/page-flags.h | 2 ++
> >  mm/slub.c                  | 2 +-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> > index ec5d029..db5c017 100644
> > --- a/include/linux/page-flags.h
> > +++ b/include/linux/page-flags.h
> > @@ -175,6 +175,8 @@ enum pageflags {
> >       PG_reported = PG_uptodate,
> >  };
> >
> > +#define PAGE_FLAGS(flags) (flags & ((1 << __NR_PAGEFLAGS) - 1))
> > +
> >  #ifndef __GENERATING_BOUNDS_H
> >
> >  struct page; /* forward declaration */
> > diff --git a/mm/slub.c b/mm/slub.c
> > index 901a45a..a93a03c 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -643,7 +643,7 @@ static void print_page_info(struct page *page)
> >  {
> >       pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=%#lx(%pGp)\n",
> >              page, page->objects, page->inuse, page->freelist,
> > -            page->flags, &page->flags);
> > +            PAGE_FLAGS(page->flags), &page->flags);
> >
> >  }
> >
> >
>
>
> --
> Thanks,
>
> David / dhildenb
>


-- 
Thanks
Yafang


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] mm, slub: use pGp to print page flags
  2021-01-15  8:46   ` David Hildenbrand
@ 2021-01-15 10:14     ` Yafang Shao
  0 siblings, 0 replies; 9+ messages in thread
From: Yafang Shao @ 2021-01-15 10:14 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Christoph Lameter, penberg, David Rientjes, iamjoonsoo.kim,
	Andrew Morton, Matthew Wilcox, Johannes Weiner, Michal Hocko,
	osalvador, linmiaohe, steven.price, Roman Gushchin, Huang, Ying,
	Linux MM

On Fri, Jan 15, 2021 at 4:47 PM David Hildenbrand <david@redhat.com> wrote:
>
> On 15.01.21 07:13, Yafang Shao wrote:
> > As pGp has been already introduced in printk, we'd better use it to make
> > the output human readable.
> >
> > Before this change, the output is,
> > [ 6155.716018] INFO: Slab 0x000000004027dd4f objects=33 used=3 fp=0x000000008cd1579c flags=0x17ffffc0010200
> >
> > While after this change, the output is,
> > [ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head)
> >
> > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> > ---
> >  mm/slub.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/mm/slub.c b/mm/slub.c
> > index dc5b42e..901a45a 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -641,8 +641,9 @@ void print_tracking(struct kmem_cache *s, void *object)
> >
> >  static void print_page_info(struct page *page)
> >  {
> > -     pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=0x%04lx\n",
> > -            page, page->objects, page->inuse, page->freelist, page->flags);
> > +     pr_err("INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=%#lx(%pGp)\n",
> > +            page, page->objects, page->inuse, page->freelist,
> > +            page->flags, &page->flags);
> >
> >  }
> >
> >
>
> Sounds helpful to me.
>
> "pr_err" combined with "INFO" looks a little weird - "Oh my, something
> serious just happened!!!! - but, hey, just for your information ... " :)
>

Ah, it seems we should improve it.
There are many pr_err("INFO) in mm/slub.c...
I will change them all in a separate patch.


> Reviewed-by: David Hildenbrand <david@redhat.com>

Thanks for the review.



-- 
Thanks
Yafang


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better
  2021-01-15 10:10     ` Yafang Shao
@ 2021-01-15 10:15       ` David Hildenbrand
  2021-01-15 10:17         ` Yafang Shao
  0 siblings, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2021-01-15 10:15 UTC (permalink / raw)
  To: Yafang Shao
  Cc: Christoph Lameter, penberg, David Rientjes, iamjoonsoo.kim,
	Andrew Morton, Matthew Wilcox, Johannes Weiner, Michal Hocko,
	osalvador, linmiaohe, steven.price, Roman Gushchin, Huang, Ying,
	Linux MM

On 15.01.21 11:10, Yafang Shao wrote:
> On Fri, Jan 15, 2021 at 4:39 PM David Hildenbrand <david@redhat.com> wrote:
>>
>> On 15.01.21 07:13, Yafang Shao wrote:
>>> There're totally __NR_PAGEFLAGS page flags, but the type of page->flags is
>>> unsigned long, that makes the value of page->flags a little misleading when
>>> it is printed to the user. We'd better print the real pages flags, instead
>>> of the whole 64bits including the random values in the useless high bits.
>>
>> No, these are *not* random values. They include the nid, zid, and
>> section_nr - which are helpful to have at hand when debugging, or
>> detecting that something might be messed up there.
>>
> 
> Thanks for the explanation. I just noticed the page-flags layout in
> page-flags-layout.h.
> 
>>>
>>> There're two choices to achieve that, one of which is clear the useless
>>
>> Again, not useless.
>>
>>> high bits when we initlize the page->flags, the other is don't print the
>>> high bits when it is showed to the user. The latter one is better because
>>> it is in the slow path and the performance won't be impacted.
>>>
>>> Before that change, the output is,
>>> [ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head)
>>>
>>> After that change, the output is,
>>> [ 8843.757770] INFO: Slab 0x00000000f0e98335 objects=33 used=3 fp=0x00000000b643c7d8 flags=0x10200(slab|head)
>>>
>>
>> Nack to the current approach. If you're going to strip this information,
>> you should expose it differently. E.g., printing page_zonenum() or
>> page_to_nid(). But still, then we might lose valuable information of
>> bits stored in there that shouldn't have been set.
>>
> 
> How about changing the implementation of pGp in printk() ?
> In the new implementation of pGp we can dump the full information of
> page->flags, rather than the flag's name only.
> 
> For example,
> 0xXXXXXXXX(node n, nid n, ..., slab|head)
> 
> That will make it easier to understand, as it is not easy to look into
> the detail of page-flags layout.

Not completely opposed to this. Just keep in mind that the information
stored in the high bits differs per configuration. See
include/linux/page-flags-layout.h

So to dump reliably, you would have to consider all different flavors,
looking at SECTIONS_WIDTH, NODES_WIDTH, ZONES_WIDTH, LAST_CPUPID_WIDTH,
KASAN_TAG_WIDTH

Might be helpful for other users as well, like in mm/memory-failure.c

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better
  2021-01-15 10:15       ` David Hildenbrand
@ 2021-01-15 10:17         ` Yafang Shao
  0 siblings, 0 replies; 9+ messages in thread
From: Yafang Shao @ 2021-01-15 10:17 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Christoph Lameter, penberg, David Rientjes, iamjoonsoo.kim,
	Andrew Morton, Matthew Wilcox, Johannes Weiner, Michal Hocko,
	osalvador, linmiaohe, steven.price, Roman Gushchin, Huang, Ying,
	Linux MM

On Fri, Jan 15, 2021 at 6:15 PM David Hildenbrand <david@redhat.com> wrote:
>
> On 15.01.21 11:10, Yafang Shao wrote:
> > On Fri, Jan 15, 2021 at 4:39 PM David Hildenbrand <david@redhat.com> wrote:
> >>
> >> On 15.01.21 07:13, Yafang Shao wrote:
> >>> There're totally __NR_PAGEFLAGS page flags, but the type of page->flags is
> >>> unsigned long, that makes the value of page->flags a little misleading when
> >>> it is printed to the user. We'd better print the real pages flags, instead
> >>> of the whole 64bits including the random values in the useless high bits.
> >>
> >> No, these are *not* random values. They include the nid, zid, and
> >> section_nr - which are helpful to have at hand when debugging, or
> >> detecting that something might be messed up there.
> >>
> >
> > Thanks for the explanation. I just noticed the page-flags layout in
> > page-flags-layout.h.
> >
> >>>
> >>> There're two choices to achieve that, one of which is clear the useless
> >>
> >> Again, not useless.
> >>
> >>> high bits when we initlize the page->flags, the other is don't print the
> >>> high bits when it is showed to the user. The latter one is better because
> >>> it is in the slow path and the performance won't be impacted.
> >>>
> >>> Before that change, the output is,
> >>> [ 8846.517809] INFO: Slab 0x00000000f42a2c60 objects=33 used=3 fp=0x0000000060d32ca8 flags=0x17ffffc0010200(slab|head)
> >>>
> >>> After that change, the output is,
> >>> [ 8843.757770] INFO: Slab 0x00000000f0e98335 objects=33 used=3 fp=0x00000000b643c7d8 flags=0x10200(slab|head)
> >>>
> >>
> >> Nack to the current approach. If you're going to strip this information,
> >> you should expose it differently. E.g., printing page_zonenum() or
> >> page_to_nid(). But still, then we might lose valuable information of
> >> bits stored in there that shouldn't have been set.
> >>
> >
> > How about changing the implementation of pGp in printk() ?
> > In the new implementation of pGp we can dump the full information of
> > page->flags, rather than the flag's name only.
> >
> > For example,
> > 0xXXXXXXXX(node n, nid n, ..., slab|head)
> >
> > That will make it easier to understand, as it is not easy to look into
> > the detail of page-flags layout.
>
> Not completely opposed to this. Just keep in mind that the information
> stored in the high bits differs per configuration. See
> include/linux/page-flags-layout.h
>
> So to dump reliably, you would have to consider all different flavors,
> looking at SECTIONS_WIDTH, NODES_WIDTH, ZONES_WIDTH, LAST_CPUPID_WIDTH,
> KASAN_TAG_WIDTH
>
> Might be helpful for other users as well, like in mm/memory-failure.c
>

Thanks for the suggestion.
I will think about it.

-- 
Thanks
Yafang


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-01-15 10:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15  6:13 [PATCH 0/2] mm: improve the output of print_page_info() Yafang Shao
2021-01-15  6:13 ` [PATCH 1/2] mm, slub: use pGp to print page flags Yafang Shao
2021-01-15  8:46   ` David Hildenbrand
2021-01-15 10:14     ` Yafang Shao
2021-01-15  6:13 ` [PATCH 2/2] mm: introduce PAGE_FLAGS() to make output of page flags better Yafang Shao
2021-01-15  8:39   ` David Hildenbrand
2021-01-15 10:10     ` Yafang Shao
2021-01-15 10:15       ` David Hildenbrand
2021-01-15 10:17         ` Yafang Shao

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.