Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1732472

[PATCH 2/3] tools: slabinfo: add "-U" option to show unreclaimable slabs only

From "Yang Shi" <yang.s@alibaba-inc.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] tools: slabinfo: add "-U" option to show unreclaimable slabs only
Date 2017-09-14 19:20 +0200
Message-ID <upFXY-7Vl-19@gated-at.bofh.it> (permalink)
References <upFXY-7Vl-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add "-U" option to show unreclaimable slabs only.

"-U" and "-S" together can tell us what unreclaimable slabs use the most
memory to help debug huge unreclaimable slabs issue.

Signed-off-by: Yang Shi <yang.s@alibaba-inc.com>
---
 tools/vm/slabinfo.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/vm/slabinfo.c b/tools/vm/slabinfo.c
index b9d34b3..9673190 100644
--- a/tools/vm/slabinfo.c
+++ b/tools/vm/slabinfo.c
@@ -83,6 +83,7 @@ struct aliasinfo {
 int sort_loss;
 int extended_totals;
 int show_bytes;
+int unreclaim_only;
 
 /* Debug options */
 int sanity;
@@ -132,6 +133,7 @@ static void usage(void)
 		"-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"
@@ -568,6 +570,9 @@ static void slabcache(struct slabinfo *s)
 	if (strcmp(s->name, "*") == 0)
 		return;
 
+	if (unreclaim_only && s->reclaim_account)
+		return;
+		
 	if (actual_slabs == 1) {
 		report(s);
 		return;
@@ -1346,6 +1351,7 @@ struct option opts[] = {
 	{ "Loss", no_argument, NULL, 'L'},
 	{ "Xtotals", no_argument, NULL, 'X'},
 	{ "Bytes", no_argument, NULL, 'B'},
+	{ "unreclaim", no_argument, NULL, 'U'},
 	{ NULL, 0, NULL, 0 }
 };
 
@@ -1357,7 +1363,7 @@ int main(int argc, char *argv[])
 
 	page_size = getpagesize();
 
-	while ((c = getopt_long(argc, argv, "aAd::Defhil1noprstvzTSN:LXB",
+	while ((c = getopt_long(argc, argv, "aAd::Defhil1noprstvzTSN:LXBU",
 						opts, NULL)) != -1)
 		switch (c) {
 		case '1':
@@ -1438,6 +1444,9 @@ int main(int argc, char *argv[])
 		case 'B':
 			show_bytes = 1;
 			break;
+		case 'U':
+			unreclaim_only = 1;
+			break;
 		default:
 			fatal("%s: Invalid option '%c'\n", argv[0], optopt);
 
-- 
1.8.3.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] oom: capture unreclaimable slab info in oom message when kernel panic "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-14 19:20 +0200
  [PATCH 1/3] mm: slab: output reclaimable flag in /proc/slabinfo "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-14 19:20 +0200
    Re: [PATCH 1/3] mm: slab: output reclaimable flag in  /proc/slabinfo Christopher Lameter <cl@linux.com> - 2017-09-14 19:30 +0200
      Re: [PATCH 1/3] mm: slab: output reclaimable flag in /proc/slabinfo "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-14 20:00 +0200
  [PATCH 2/3] tools: slabinfo: add "-U" option to show unreclaimable slabs only "Yang Shi" <yang.s@alibaba-inc.com> - 2017-09-14 19:20 +0200
    Re: [PATCH 2/3] tools: slabinfo: add "-U" option to show unreclaimable  slabs only Christopher Lameter <cl@linux.com> - 2017-09-14 19:30 +0200

csiph-web