linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Kassey Li <kassey.li@oss.qualcomm.com>,
	akpm@linux-foundation.org, cl@gentwo.org, rientjes@google.com,
	roman.gushchin@linux.dev, harry.yoo@oracle.com,
	linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] slab: add flags in cache_show
Date: Fri, 17 Oct 2025 12:50:49 +0200	[thread overview]
Message-ID: <910a1d39-ca72-4e79-9f6d-66415794d9a9@suse.cz> (raw)
In-Reply-To: <20251017064839.585204-1-kassey.li@oss.qualcomm.com>

On 10/17/25 08:48, Kassey Li wrote:
> Flags info is useful to check the slab type.
> 
> for example, _SLAB_RECLAIM_ACCOUNT:
> 
>     0x50100 _SLAB_PANIC _SLAB_RECLAIM_ACCOUNT _SLAB_CMPXCHG_DOUBLE
> 
> Signed-off-by: Kassey Li <kassey.li@oss.qualcomm.com>

Many of the flags are represented by files in /sys/kernel/slab/<cache>/
If you miss some, we could add it there. Changing slabinfo output could
break some users and the raw hex value is not a stable representation of the
flags anyway.

> ---
>  mm/slab_common.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 932d13ada36c..f43239211e69 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -1083,7 +1083,7 @@ static void print_slabinfo_header(struct seq_file *m)
>  	 * without _too_ many complaints.
>  	 */
>  	seq_puts(m, "slabinfo - version: 2.1\n");
> -	seq_puts(m, "# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab>");
> +	seq_puts(m, "# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> <flags>");
>  	seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
>  	seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
>  	seq_putc(m, '\n');
> @@ -1112,9 +1112,9 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m)
>  	memset(&sinfo, 0, sizeof(sinfo));
>  	get_slabinfo(s, &sinfo);
>  
> -	seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d",
> +	seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d 0x%-8x",
>  		   s->name, sinfo.active_objs, sinfo.num_objs, s->size,
> -		   sinfo.objects_per_slab, (1 << sinfo.cache_order));
> +		   sinfo.objects_per_slab, (1 << sinfo.cache_order), s->flags);
>  
>  	seq_printf(m, " : tunables %4u %4u %4u",
>  		   sinfo.limit, sinfo.batchcount, sinfo.shared);



  reply	other threads:[~2025-10-17 10:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  6:48 Kassey Li
2025-10-17 10:50 ` Vlastimil Babka [this message]
2025-10-24  3:06   ` Kassey Li
2025-10-24  8:22     ` Vlastimil Babka
2025-10-27  1:08       ` Kassey Li

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=910a1d39-ca72-4e79-9f6d-66415794d9a9@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=harry.yoo@oracle.com \
    --cc=kassey.li@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    /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