linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] Slabinfo: Fix display format
  2010-06-17 15:54 [PATCH] Slabinfo: Fix display format wzt.wzt
@ 2010-06-17 13:45 ` Christoph Lameter
  2010-06-17 14:10   ` wzt wzt
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Lameter @ 2010-06-17 13:45 UTC (permalink / raw)
  To: wzt.wzt; +Cc: linux-kernel, linux-mm, penberg, mpm

On Thu, 17 Jun 2010, wzt.wzt@gmail.com wrote:

> @@ -4271,7 +4271,7 @@ static int s_show(struct seq_file *m, void *p)
>  	if (error)
>  		printk(KERN_ERR "slab: cache %s error: %s\n", name, error);
>
> -	seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d",
> +	seq_printf(m, "%-27s %6lu %6lu %6u %4u %4d",
>  		   name, active_objs, num_objs, cachep->buffer_size,
>  		   cachep->num, (1 << cachep->gfporder));
>  	seq_printf(m, " : tunables %4u %4u %4u",

This one may break user space tools that have assumptions about the length
of the field. Or do tools not make that assumption?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] Slabinfo: Fix display format
  2010-06-17 13:45 ` Christoph Lameter
@ 2010-06-17 14:10   ` wzt wzt
  2010-06-18  6:09     ` Pekka Enberg
  0 siblings, 1 reply; 4+ messages in thread
From: wzt wzt @ 2010-06-17 14:10 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-kernel, linux-mm, penberg, mpm

On Thu, Jun 17, 2010 at 9:45 PM, Christoph Lameter
<cl@linux-foundation.org> wrote:
> On Thu, 17 Jun 2010, wzt.wzt@gmail.com wrote:

> This one may break user space tools that have assumptions about the length
> of the field. Or do tools not make that assumption?
>

User space tools usually use sscanf() to extract this field like:
sscanf(buff, "%s %d", name, &num);
If %-27s can break some user space tools that have assumptions about
the length of the field, the orig %-17s can also break it.
The longest name inotify_event_private_data is 26 bytes in 2.6.34-rc2,
the tools still can't extract it.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH] Slabinfo: Fix display format
@ 2010-06-17 15:54 wzt.wzt
  2010-06-17 13:45 ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: wzt.wzt @ 2010-06-17 15:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, cl, penberg, mpm

Fix slabinfo display format, if a structure length > 17, the information display like:

[root@localhost ~]# cat /proc/slabinfo
flow_cache             0      0     80   48    1 : tunables  120   60    8 : slabdata      0      0      0
cfq_io_context        40    112     68   56    1 : tunables  120   60    8 : slabdata      2      2      0
cfq_queue             30     52    152   26    1 : tunables  120   60    8 : slabdata      2      2      0
bsg_cmd                0      0    284   14    1 : tunables   54   27    8 : slabdata      0      0      0
mqueue_inode_cache      1      7    576    7    1 : tunables   54   27    8 : slabdata      1      1      0
isofs_inode_cache      0      0    380   10    1 : tunables   54   27    8 : slabdata      0      0      0
hugetlbfs_inode_cache      1     11    352   11    1 : tunables   54   27    8 : slabdata      1      1      0
ext2_inode_cache       0      0    496    8    1 : tunables   54   27    8 : slabdata      0      0      0
ext2_xattr             0      0     48   78    1 : tunables  120   60    8 : slabdata      0      0      0
dquot                  0      0    192   20    1 : tunables  120   60    8 : slabdata      0      0      0
kioctx                 0      0    192   20    1 : tunables  120   60    8 : slabdata      0      0      0
kiocb                  0      0    128   30    1 : tunables  120   60    8 : slabdata      0      0      0

Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>

---
 mm/slab.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index e49f8f4..3bcba98 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4181,7 +4181,7 @@ 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> "
+	seq_puts(m, "# name\t\t\t<active_objs> <num_objs> <objsize> "
 		 "<objperslab> <pagesperslab>");
 	seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
 	seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
@@ -4271,7 +4271,7 @@ static int s_show(struct seq_file *m, void *p)
 	if (error)
 		printk(KERN_ERR "slab: cache %s error: %s\n", name, error);
 
-	seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d",
+	seq_printf(m, "%-27s %6lu %6lu %6u %4u %4d",
 		   name, active_objs, num_objs, cachep->buffer_size,
 		   cachep->num, (1 << cachep->gfporder));
 	seq_printf(m, " : tunables %4u %4u %4u",
-- 
1.6.5.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] Slabinfo: Fix display format
  2010-06-17 14:10   ` wzt wzt
@ 2010-06-18  6:09     ` Pekka Enberg
  0 siblings, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2010-06-18  6:09 UTC (permalink / raw)
  To: wzt wzt; +Cc: Christoph Lameter, linux-kernel, linux-mm, mpm

On 6/17/10 5:10 PM, wzt wzt wrote:
> On Thu, Jun 17, 2010 at 9:45 PM, Christoph Lameter
> <cl@linux-foundation.org>  wrote:
>> On Thu, 17 Jun 2010, wzt.wzt@gmail.com wrote:
>
>> This one may break user space tools that have assumptions about the length
>> of the field. Or do tools not make that assumption?
>
> User space tools usually use sscanf() to extract this field like:
> sscanf(buff, "%s %d", name,&num);
> If %-27s can break some user space tools that have assumptions about
> the length of the field, the orig %-17s can also break it.
> The longest name inotify_event_private_data is 26 bytes in 2.6.34-rc2,
> the tools still can't extract it.

NAK. It's an ABI so the risks of this format cleanup outweight the benefits.

			Pekka

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2010-06-18  6:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-17 15:54 [PATCH] Slabinfo: Fix display format wzt.wzt
2010-06-17 13:45 ` Christoph Lameter
2010-06-17 14:10   ` wzt wzt
2010-06-18  6:09     ` Pekka Enberg

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).