Commit eefaca9c3246f3daf56e7ed02987f79abcee7087

Authored by Christoph Lameter
Committed by Linus Torvalds
1 parent ade3aff25f

SLUB: slabinfo fixes

Align the output of % with K/M/G of sizes.

Check for empty NUMA information to avoid segfault on !NUMA.

-r should work directly not only if we match a single slab
   without additional options.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 12 additions and 5 deletions Side-by-side Diff

Documentation/vm/slabinfo.c
... ... @@ -242,6 +242,9 @@
242 242  
243 243 memset(numa, 0, MAX_NODES * sizeof(int));
244 244  
  245 + if (!t)
  246 + return;
  247 +
245 248 while (*t == 'N') {
246 249 t++;
247 250 node = strtoul(t, &t, 10);
... ... @@ -386,7 +389,9 @@
386 389 {
387 390 if (strcmp(s->name, "*") == 0)
388 391 return;
389   - printf("\nSlabcache: %-20s Aliases: %2d Order : %2d\n", s->name, s->aliases, s->order);
  392 +
  393 + printf("\nSlabcache: %-20s Aliases: %2d Order : %2d Objects: %d\n",
  394 + s->name, s->aliases, s->order, s->objects);
390 395 if (s->hwcache_align)
391 396 printf("** Hardware cacheline aligned\n");
392 397 if (s->cache_dma)
393 398  
... ... @@ -791,11 +796,11 @@
791 796  
792 797 store_size(b1, total_size);store_size(b2, total_waste);
793 798 store_size(b3, total_waste * 100 / total_used);
794   - printf("Memory used: %6s # Loss : %6s MRatio: %6s%%\n", b1, b2, b3);
  799 + printf("Memory used: %6s # Loss : %6s MRatio:%6s%%\n", b1, b2, b3);
795 800  
796 801 store_size(b1, total_objects);store_size(b2, total_partobj);
797 802 store_size(b3, total_partobj * 100 / total_objects);
798   - printf("# Objects : %6s # PartObj: %6s ORatio: %6s%%\n", b1, b2, b3);
  803 + printf("# Objects : %6s # PartObj: %6s ORatio:%6s%%\n", b1, b2, b3);
799 804  
800 805 printf("\n");
801 806 printf("Per Cache Average Min Max Total\n");
... ... @@ -818,7 +823,7 @@
818 823 store_size(b1, avg_ppart);store_size(b2, min_ppart);
819 824 store_size(b3, max_ppart);
820 825 store_size(b4, total_partial * 100 / total_slabs);
821   - printf("%%PartSlab %10s%% %10s%% %10s%% %10s%%\n",
  826 + printf("%%PartSlab%10s%% %10s%% %10s%% %10s%%\n",
822 827 b1, b2, b3, b4);
823 828  
824 829 store_size(b1, avg_partobj);store_size(b2, min_partobj);
... ... @@ -830,7 +835,7 @@
830 835 store_size(b1, avg_ppartobj);store_size(b2, min_ppartobj);
831 836 store_size(b3, max_ppartobj);
832 837 store_size(b4, total_partobj * 100 / total_objects);
833   - printf("%% PartObj %10s%% %10s%% %10s%% %10s%%\n",
  838 + printf("%% PartObj%10s%% %10s%% %10s%% %10s%%\n",
834 839 b1, b2, b3, b4);
835 840  
836 841 store_size(b1, avg_size);store_size(b2, min_size);
... ... @@ -1100,6 +1105,8 @@
1100 1105 ops(slab);
1101 1106 else if (show_slab)
1102 1107 slabcache(slab);
  1108 + else if (show_report)
  1109 + report(slab);
1103 1110 }
1104 1111 }
1105 1112