diff options
Diffstat (limited to 'tools/slub/slabinfo.c')
-rw-r--r-- | tools/slub/slabinfo.c | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/tools/slub/slabinfo.c b/tools/slub/slabinfo.c index 516551c9f172..868cc93f7ac2 100644 --- a/tools/slub/slabinfo.c +++ b/tools/slub/slabinfo.c | |||
@@ -2,8 +2,9 @@ | |||
2 | * Slabinfo: Tool to get reports about slabs | 2 | * Slabinfo: Tool to get reports about slabs |
3 | * | 3 | * |
4 | * (C) 2007 sgi, Christoph Lameter | 4 | * (C) 2007 sgi, Christoph Lameter |
5 | * (C) 2011 Linux Foundation, Christoph Lameter | ||
5 | * | 6 | * |
6 | * Compile by: | 7 | * Compile with: |
7 | * | 8 | * |
8 | * gcc -o slabinfo slabinfo.c | 9 | * gcc -o slabinfo slabinfo.c |
9 | */ | 10 | */ |
@@ -39,6 +40,8 @@ struct slabinfo { | |||
39 | unsigned long cpuslab_flush, deactivate_full, deactivate_empty; | 40 | unsigned long cpuslab_flush, deactivate_full, deactivate_empty; |
40 | unsigned long deactivate_to_head, deactivate_to_tail; | 41 | unsigned long deactivate_to_head, deactivate_to_tail; |
41 | unsigned long deactivate_remote_frees, order_fallback; | 42 | unsigned long deactivate_remote_frees, order_fallback; |
43 | unsigned long cmpxchg_double_cpu_fail, cmpxchg_double_fail; | ||
44 | unsigned long alloc_node_mismatch, deactivate_bypass; | ||
42 | int numa[MAX_NODES]; | 45 | int numa[MAX_NODES]; |
43 | int numa_partial[MAX_NODES]; | 46 | int numa_partial[MAX_NODES]; |
44 | } slabinfo[MAX_SLABS]; | 47 | } slabinfo[MAX_SLABS]; |
@@ -99,7 +102,7 @@ static void fatal(const char *x, ...) | |||
99 | 102 | ||
100 | static void usage(void) | 103 | static void usage(void) |
101 | { | 104 | { |
102 | printf("slabinfo 5/7/2007. (c) 2007 sgi.\n\n" | 105 | printf("slabinfo 4/15/2011. (c) 2007 sgi/(c) 2011 Linux Foundation.\n\n" |
103 | "slabinfo [-ahnpvtsz] [-d debugopts] [slab-regexp]\n" | 106 | "slabinfo [-ahnpvtsz] [-d debugopts] [slab-regexp]\n" |
104 | "-a|--aliases Show aliases\n" | 107 | "-a|--aliases Show aliases\n" |
105 | "-A|--activity Most active slabs first\n" | 108 | "-A|--activity Most active slabs first\n" |
@@ -293,7 +296,7 @@ int line = 0; | |||
293 | static void first_line(void) | 296 | static void first_line(void) |
294 | { | 297 | { |
295 | if (show_activity) | 298 | if (show_activity) |
296 | printf("Name Objects Alloc Free %%Fast Fallb O\n"); | 299 | printf("Name Objects Alloc Free %%Fast Fallb O CmpX UL\n"); |
297 | else | 300 | else |
298 | printf("Name Objects Objsize Space " | 301 | printf("Name Objects Objsize Space " |
299 | "Slabs/Part/Cpu O/S O %%Fr %%Ef Flg\n"); | 302 | "Slabs/Part/Cpu O/S O %%Fr %%Ef Flg\n"); |
@@ -379,14 +382,14 @@ static void show_tracking(struct slabinfo *s) | |||
379 | printf("\n%s: Kernel object allocation\n", s->name); | 382 | printf("\n%s: Kernel object allocation\n", s->name); |
380 | printf("-----------------------------------------------------------------------\n"); | 383 | printf("-----------------------------------------------------------------------\n"); |
381 | if (read_slab_obj(s, "alloc_calls")) | 384 | if (read_slab_obj(s, "alloc_calls")) |
382 | printf(buffer); | 385 | printf("%s", buffer); |
383 | else | 386 | else |
384 | printf("No Data\n"); | 387 | printf("No Data\n"); |
385 | 388 | ||
386 | printf("\n%s: Kernel object freeing\n", s->name); | 389 | printf("\n%s: Kernel object freeing\n", s->name); |
387 | printf("------------------------------------------------------------------------\n"); | 390 | printf("------------------------------------------------------------------------\n"); |
388 | if (read_slab_obj(s, "free_calls")) | 391 | if (read_slab_obj(s, "free_calls")) |
389 | printf(buffer); | 392 | printf("%s", buffer); |
390 | else | 393 | else |
391 | printf("No Data\n"); | 394 | printf("No Data\n"); |
392 | 395 | ||
@@ -400,7 +403,7 @@ static void ops(struct slabinfo *s) | |||
400 | if (read_slab_obj(s, "ops")) { | 403 | if (read_slab_obj(s, "ops")) { |
401 | printf("\n%s: kmem_cache operations\n", s->name); | 404 | printf("\n%s: kmem_cache operations\n", s->name); |
402 | printf("--------------------------------------------\n"); | 405 | printf("--------------------------------------------\n"); |
403 | printf(buffer); | 406 | printf("%s", buffer); |
404 | } else | 407 | } else |
405 | printf("\n%s has no kmem_cache operations\n", s->name); | 408 | printf("\n%s has no kmem_cache operations\n", s->name); |
406 | } | 409 | } |
@@ -462,19 +465,32 @@ static void slab_stats(struct slabinfo *s) | |||
462 | if (s->cpuslab_flush) | 465 | if (s->cpuslab_flush) |
463 | printf("Flushes %8lu\n", s->cpuslab_flush); | 466 | printf("Flushes %8lu\n", s->cpuslab_flush); |
464 | 467 | ||
465 | if (s->alloc_refill) | ||
466 | printf("Refill %8lu\n", s->alloc_refill); | ||
467 | |||
468 | total = s->deactivate_full + s->deactivate_empty + | 468 | total = s->deactivate_full + s->deactivate_empty + |
469 | s->deactivate_to_head + s->deactivate_to_tail; | 469 | s->deactivate_to_head + s->deactivate_to_tail + s->deactivate_bypass; |
470 | 470 | ||
471 | if (total) | 471 | if (total) { |
472 | printf("Deactivate Full=%lu(%lu%%) Empty=%lu(%lu%%) " | 472 | printf("\nSlab Deactivation Ocurrences %%\n"); |
473 | "ToHead=%lu(%lu%%) ToTail=%lu(%lu%%)\n", | 473 | printf("-------------------------------------------------\n"); |
474 | s->deactivate_full, (s->deactivate_full * 100) / total, | 474 | printf("Slab full %7lu %3lu%%\n", |
475 | s->deactivate_empty, (s->deactivate_empty * 100) / total, | 475 | s->deactivate_full, (s->deactivate_full * 100) / total); |
476 | s->deactivate_to_head, (s->deactivate_to_head * 100) / total, | 476 | printf("Slab empty %7lu %3lu%%\n", |
477 | s->deactivate_empty, (s->deactivate_empty * 100) / total); | ||
478 | printf("Moved to head of partial list %7lu %3lu%%\n", | ||
479 | s->deactivate_to_head, (s->deactivate_to_head * 100) / total); | ||
480 | printf("Moved to tail of partial list %7lu %3lu%%\n", | ||
477 | s->deactivate_to_tail, (s->deactivate_to_tail * 100) / total); | 481 | s->deactivate_to_tail, (s->deactivate_to_tail * 100) / total); |
482 | printf("Deactivation bypass %7lu %3lu%%\n", | ||
483 | s->deactivate_bypass, (s->deactivate_bypass * 100) / total); | ||
484 | printf("Refilled from foreign frees %7lu %3lu%%\n", | ||
485 | s->alloc_refill, (s->alloc_refill * 100) / total); | ||
486 | printf("Node mismatch %7lu %3lu%%\n", | ||
487 | s->alloc_node_mismatch, (s->alloc_node_mismatch * 100) / total); | ||
488 | } | ||
489 | |||
490 | if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail) | ||
491 | printf("\nCmpxchg_double Looping\n------------------------\n"); | ||
492 | printf("Locked Cmpxchg Double redos %lu\nUnlocked Cmpxchg Double redos %lu\n", | ||
493 | s->cmpxchg_double_fail, s->cmpxchg_double_cpu_fail); | ||
478 | } | 494 | } |
479 | 495 | ||
480 | static void report(struct slabinfo *s) | 496 | static void report(struct slabinfo *s) |
@@ -573,12 +589,13 @@ static void slabcache(struct slabinfo *s) | |||
573 | total_alloc = s->alloc_fastpath + s->alloc_slowpath; | 589 | total_alloc = s->alloc_fastpath + s->alloc_slowpath; |
574 | total_free = s->free_fastpath + s->free_slowpath; | 590 | total_free = s->free_fastpath + s->free_slowpath; |
575 | 591 | ||
576 | printf("%-21s %8ld %10ld %10ld %3ld %3ld %5ld %1d\n", | 592 | printf("%-21s %8ld %10ld %10ld %3ld %3ld %5ld %1d %4ld %4ld\n", |
577 | s->name, s->objects, | 593 | s->name, s->objects, |
578 | total_alloc, total_free, | 594 | total_alloc, total_free, |
579 | total_alloc ? (s->alloc_fastpath * 100 / total_alloc) : 0, | 595 | total_alloc ? (s->alloc_fastpath * 100 / total_alloc) : 0, |
580 | total_free ? (s->free_fastpath * 100 / total_free) : 0, | 596 | total_free ? (s->free_fastpath * 100 / total_free) : 0, |
581 | s->order_fallback, s->order); | 597 | s->order_fallback, s->order, s->cmpxchg_double_fail, |
598 | s->cmpxchg_double_cpu_fail); | ||
582 | } | 599 | } |
583 | else | 600 | else |
584 | printf("%-21s %8ld %7d %8s %14s %4d %1d %3ld %3ld %s\n", | 601 | printf("%-21s %8ld %7d %8s %14s %4d %1d %3ld %3ld %s\n", |
@@ -1190,6 +1207,10 @@ static void read_slab_dir(void) | |||
1190 | slab->deactivate_to_tail = get_obj("deactivate_to_tail"); | 1207 | slab->deactivate_to_tail = get_obj("deactivate_to_tail"); |
1191 | slab->deactivate_remote_frees = get_obj("deactivate_remote_frees"); | 1208 | slab->deactivate_remote_frees = get_obj("deactivate_remote_frees"); |
1192 | slab->order_fallback = get_obj("order_fallback"); | 1209 | slab->order_fallback = get_obj("order_fallback"); |
1210 | slab->cmpxchg_double_cpu_fail = get_obj("cmpxchg_double_cpu_fail"); | ||
1211 | slab->cmpxchg_double_fail = get_obj("cmpxchg_double_fail"); | ||
1212 | slab->alloc_node_mismatch = get_obj("alloc_node_mismatch"); | ||
1213 | slab->deactivate_bypass = get_obj("deactivate_bypass"); | ||
1193 | chdir(".."); | 1214 | chdir(".."); |
1194 | if (slab->name[0] == ':') | 1215 | if (slab->name[0] == ':') |
1195 | alias_targets++; | 1216 | alias_targets++; |