* [PATCH] mm:slab: Adjust the print format for the slabinfo
@ 2018-10-02 2:59 jun qian
2018-10-02 5:57 ` Michal Hocko
2018-10-02 15:04 ` Vlastimil Babka
0 siblings, 2 replies; 3+ messages in thread
From: jun qian @ 2018-10-02 2:59 UTC (permalink / raw)
To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
Andrew Morton
Cc: linux-mm, linux-kernel, jun qian, Barry song
Header and the corresponding information is not aligned,
adjust the printing format helps us to understand the slabinfo better.
Signed-off-by: jun qian <hangdianqj@163.com>
Cc: Barry song <21cnbao@gmail.com>
---
mm/slab_common.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index fea3376f9816..07a324cbbfb6 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1263,9 +1263,13 @@ static void print_slabinfo_header(struct seq_file *m)
#else
seq_puts(m, "slabinfo - version: 2.1\n");
#endif
- seq_puts(m, "# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab>");
- seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
- seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
+ seq_printf(m, "%-22s %-14s %-11s %-10s %-13s %-14s",
+ "# name", "<active_objs>", "<num_objs>", "<objsize>",
+ "<objperslab>", "<pagesperslab>");
+ seq_printf(m, " : %-9s %-8s %-13s %-14s",
+ "tunables", "<limit>", "<batchcount>", "<sharedfactor>");
+ seq_printf(m, " : %-9s %-15s %-12s %-16s",
+ "slabdata", "<active_slabs>", "<num_slabs>", "<sharedavail>");
#ifdef CONFIG_DEBUG_SLAB
seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> <error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow>");
seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>");
@@ -1319,13 +1323,13 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m)
memcg_accumulate_slabinfo(s, &sinfo);
- seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d",
+ seq_printf(m, "%-22s %-14lu %-11lu %-10u %-13u %-14d",
cache_name(s), sinfo.active_objs, sinfo.num_objs, s->size,
sinfo.objects_per_slab, (1 << sinfo.cache_order));
- seq_printf(m, " : tunables %4u %4u %4u",
+ seq_printf(m, " : %-9s %-8u %-13u %-14u", "tunables",
sinfo.limit, sinfo.batchcount, sinfo.shared);
- seq_printf(m, " : slabdata %6lu %6lu %6lu",
+ seq_printf(m, " : %-9s %-15lu %-12lu %-16lu", "slabdata",
sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail);
slabinfo_show_stats(m, s);
seq_putc(m, '\n');
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm:slab: Adjust the print format for the slabinfo
2018-10-02 2:59 [PATCH] mm:slab: Adjust the print format for the slabinfo jun qian
@ 2018-10-02 5:57 ` Michal Hocko
2018-10-02 15:04 ` Vlastimil Babka
1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2018-10-02 5:57 UTC (permalink / raw)
To: jun qian
Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
Andrew Morton, linux-mm, linux-kernel, Barry song
On Mon 01-10-18 19:59:39, jun qian wrote:
> Header and the corresponding information is not aligned,
> adjust the printing format helps us to understand the slabinfo better.
What prevents you from formating the output when printint the file? In
other words why do we want to do special formating in the kernel?
> Signed-off-by: jun qian <hangdianqj@163.com>
> Cc: Barry song <21cnbao@gmail.com>
> ---
> mm/slab_common.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index fea3376f9816..07a324cbbfb6 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -1263,9 +1263,13 @@ static void print_slabinfo_header(struct seq_file *m)
> #else
> seq_puts(m, "slabinfo - version: 2.1\n");
> #endif
> - seq_puts(m, "# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab>");
> - seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
> - seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
> + seq_printf(m, "%-22s %-14s %-11s %-10s %-13s %-14s",
> + "# name", "<active_objs>", "<num_objs>", "<objsize>",
> + "<objperslab>", "<pagesperslab>");
> + seq_printf(m, " : %-9s %-8s %-13s %-14s",
> + "tunables", "<limit>", "<batchcount>", "<sharedfactor>");
> + seq_printf(m, " : %-9s %-15s %-12s %-16s",
> + "slabdata", "<active_slabs>", "<num_slabs>", "<sharedavail>");
> #ifdef CONFIG_DEBUG_SLAB
> seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> <error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow>");
> seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>");
> @@ -1319,13 +1323,13 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m)
>
> memcg_accumulate_slabinfo(s, &sinfo);
>
> - seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d",
> + seq_printf(m, "%-22s %-14lu %-11lu %-10u %-13u %-14d",
> cache_name(s), sinfo.active_objs, sinfo.num_objs, s->size,
> sinfo.objects_per_slab, (1 << sinfo.cache_order));
>
> - seq_printf(m, " : tunables %4u %4u %4u",
> + seq_printf(m, " : %-9s %-8u %-13u %-14u", "tunables",
> sinfo.limit, sinfo.batchcount, sinfo.shared);
> - seq_printf(m, " : slabdata %6lu %6lu %6lu",
> + seq_printf(m, " : %-9s %-15lu %-12lu %-16lu", "slabdata",
> sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail);
> slabinfo_show_stats(m, s);
> seq_putc(m, '\n');
> --
> 2.17.1
>
>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm:slab: Adjust the print format for the slabinfo
2018-10-02 2:59 [PATCH] mm:slab: Adjust the print format for the slabinfo jun qian
2018-10-02 5:57 ` Michal Hocko
@ 2018-10-02 15:04 ` Vlastimil Babka
1 sibling, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2018-10-02 15:04 UTC (permalink / raw)
To: jun qian, Christoph Lameter, Pekka Enberg, David Rientjes,
Joonsoo Kim, Andrew Morton
Cc: linux-mm, linux-kernel, Barry song
On 10/2/18 4:59 AM, jun qian wrote:
> Header and the corresponding information is not aligned,
> adjust the printing format helps us to understand the slabinfo better.
>
> Signed-off-by: jun qian <hangdianqj@163.com>
> Cc: Barry song <21cnbao@gmail.com>
I've tried the patch and it makes the slabinfo not fit my screen
anymore, and the value density is very sparse. IMHO the current layout
is better, sorry.
Vlastimil
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-02 15:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 2:59 [PATCH] mm:slab: Adjust the print format for the slabinfo jun qian
2018-10-02 5:57 ` Michal Hocko
2018-10-02 15:04 ` Vlastimil Babka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).