Skip to contentSkip to conversation

tools/vm/slabinfo: Clean up slabinfo -h

PATCH New Tobin C. Harding 1 participant 5 messages Feb 12, 2019

lore
Share & tools
lore
#0 lore raw

cover tools/vm/slabinfo: Clean up slabinfo -h

Hi Andrew,

Here is a simple patchset cleaning up the help output message for slabinfo.

All patches include Acked-by tag from Christopher (patches were viewed and acked off list).

thanks,
Tobin

Tobin C. Harding (4):
tools/vm/slabinfo: Update options in usage message tools/vm/slabinfo: Put options in alphabetic order tools/vm/slabinfo: Align usage output columns tools/vm/slabinfo: Clean up usage menu debug items

 tools/vm/slabinfo.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/4 tools/vm/slabinfo: Update options in usage message

Currently usage message list only a subset of the available options. should list them all.

Update options in usage massage to include all available options.

---
 tools/vm/slabinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/vm/slabinfo.c +1 -1
index 334b16db0ebb..d3908c50c87c 100644
@@ -110,7 +110,7 @@ static void fatal(const char *x, ...)
 static void usage(void)
 {
 	printf("slabinfo 4/15/2011. (c) 2007 sgi/(c) 2011 Linux Foundation.\n\n"
-		"slabinfo [-ahnpvtsz] [-d debugopts] [slab-regexp]\n"
+		"slabinfo [-aADefhilnosrStTvz1LXBU] [N=K] [-dafzput] [slab-regexp]\n"
 		"-a|--aliases           Show aliases\n"
 		"-A|--activity          Most active slabs first\n"
 		"-d<options>|--debug=<options> Set/Clear Debug options\n"
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/4 tools/vm/slabinfo: Put options in alphabetic order

In reply to Tobin C. Harding

Primarily the usage message lists options in alphabetic order however there are a bunch of the options that are not in alphabetic order.

Put options in alphabetic order.

---
 tools/vm/slabinfo.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
tools/vm/slabinfo.c +6 -5
index d3908c50c87c..5119adb9d009 100644
@@ -113,6 +113,7 @@ static void usage(void)
 		"slabinfo [-aADefhilnosrStTvz1LXBU] [N=K] [-dafzput] [slab-regexp]\n"
 		"-a|--aliases           Show aliases\n"
 		"-A|--activity          Most active slabs first\n"
+		"-B|--Bytes             Show size in bytes\n"
 		"-d<options>|--debug=<options> Set/Clear Debug options\n"
 		"-D|--display-active    Switch line format to activity\n"
 		"-e|--empty             Show empty slabs\n"
@@ -120,21 +121,21 @@ static void usage(void)
 		"-h|--help              Show usage information\n"
 		"-i|--inverted          Inverted list\n"
 		"-l|--slabs             Show slabs\n"
+		"-L|--Loss              Sort by loss\n"
 		"-n|--numa              Show NUMA information\n"
+		"-N|--lines=K           Show the first K slabs\n"
 		"-o|--ops		Show kmem_cache_ops\n"
-		"-s|--shrink            Shrink slabs\n"
 		"-r|--report		Detailed report on single slabs\n"
+		"-s|--shrink            Shrink slabs\n"
 		"-S|--Size              Sort by size\n"
 		"-t|--tracking          Show alloc/free information\n"
 		"-T|--Totals            Show summary information\n"
+		"-U|--Unreclaim		Show unreclaimable slabs only\n"
 		"-v|--validate          Validate slabs\n"
 		"-z|--zero              Include empty slabs\n"
 		"-1|--1ref              Single reference\n"
-		"-N|--lines=K           Show the first K slabs\n"
-		"-L|--Loss              Sort by loss\n"
 		"-X|--Xtotals           Show extended summary information\n"
-		"-B|--Bytes             Show size in bytes\n"
-		"-U|--Unreclaim		Show unreclaimable slabs only\n"
+
 		"\nValid debug options (FZPUT may be combined)\n"
 		"a / A          Switch on all debug options (=FZUP)\n"
 		"-              Switch off all debug options\n"
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/4 tools/vm/slabinfo: Align usage output columns

In reply to Tobin C. Harding

Usage message uses spaces not tabspaces, a few tabspaces have snuck in making the columns not align correctly when output.

Align usage output columns using spaces instead of tabspaces.

---
 tools/vm/slabinfo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/vm/slabinfo.c +3 -3
index 5119adb9d009..97715b73af70 100644
@@ -124,13 +124,13 @@ static void usage(void)
 		"-L|--Loss              Sort by loss\n"
 		"-n|--numa              Show NUMA information\n"
 		"-N|--lines=K           Show the first K slabs\n"
-		"-o|--ops		Show kmem_cache_ops\n"
-		"-r|--report		Detailed report on single slabs\n"
+		"-o|--ops               Show kmem_cache_ops\n"
+		"-r|--report            Detailed report on single slabs\n"
 		"-s|--shrink            Shrink slabs\n"
 		"-S|--Size              Sort by size\n"
 		"-t|--tracking          Show alloc/free information\n"
 		"-T|--Totals            Show summary information\n"
-		"-U|--Unreclaim		Show unreclaimable slabs only\n"
+		"-U|--Unreclaim         Show unreclaimable slabs only\n"
 		"-v|--validate          Validate slabs\n"
 		"-z|--zero              Include empty slabs\n"
 		"-1|--1ref              Single reference\n"
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/4 tools/vm/slabinfo: Clean up usage menu debug items

In reply to Tobin C. Harding

Attempt to make the usage comment for debug options a little cleaner.

---
 tools/vm/slabinfo.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
tools/vm/slabinfo.c +11 -9
index 97715b73af70..73818f1b2ef8 100644
@@ -114,7 +114,6 @@ static void usage(void)
 		"-a|--aliases           Show aliases\n"
 		"-A|--activity          Most active slabs first\n"
 		"-B|--Bytes             Show size in bytes\n"
-		"-d<options>|--debug=<options> Set/Clear Debug options\n"
 		"-D|--display-active    Switch line format to activity\n"
 		"-e|--empty             Show empty slabs\n"
 		"-f|--first-alias       Show first alias\n"
@@ -136,14 +135,17 @@ static void usage(void)
 		"-1|--1ref              Single reference\n"
 		"-X|--Xtotals           Show extended summary information\n"
 
-		"\nValid debug options (FZPUT may be combined)\n"
-		"a / A          Switch on all debug options (=FZUP)\n"
-		"-              Switch off all debug options\n"
-		"f / F          Sanity Checks (SLAB_CONSISTENCY_CHECKS)\n"
-		"z / Z          Redzoning\n"
-		"p / P          Poisoning\n"
-		"u / U          Tracking\n"
-		"t / T          Tracing\n"
+		"\n"
+		"-d  | --debug          Switch off all debug options\n"
+		"-da | --debug=a        Switch on all debug options (--debug=FZPU)\n"
+
+		"\n"
+		"-d[afzput] | --debug=[afzput]\n"
+		"    f | F              Sanity Checks (SLAB_CONSISTENCY_CHECKS)\n"
+		"    z | Z              Redzoning\n"
+		"    p | P              Poisoning\n"
+		"    u | U              Tracking\n"
+		"    t | T              Tracing\n"
 	);
 }
 
Signature · 1 line
2.20.1