Skip to content

Commit eefaca9

Browse files
Christoph LameterLinus Torvalds
authored andcommitted
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>
1 parent ade3aff commit eefaca9

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎Documentation/vm/slabinfo.c‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ void decode_numa_list(int *numa, char *t)
242242

243243
memset(numa, 0, MAX_NODES * sizeof(int));
244244

245+
if (!t)
246+
return;
247+
245248
while (*t == 'N') {
246249
t++;
247250
node = strtoul(t, &t, 10);
@@ -386,7 +389,9 @@ void report(struct slabinfo *s)
386389
{
387390
if (strcmp(s->name, "*") == 0)
388391
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);
390395
if (s->hwcache_align)
391396
printf("** Hardware cacheline aligned\n");
392397
if (s->cache_dma)
@@ -791,11 +796,11 @@ void totals(void)
791796

792797
store_size(b1, total_size);store_size(b2, total_waste);
793798
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);
795800

796801
store_size(b1, total_objects);store_size(b2, total_partobj);
797802
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);
799804

800805
printf("\n");
801806
printf("Per Cache Average Min Max Total\n");
@@ -818,7 +823,7 @@ void totals(void)
818823
store_size(b1, avg_ppart);store_size(b2, min_ppart);
819824
store_size(b3, max_ppart);
820825
store_size(b4, total_partial * 100 / total_slabs);
821-
printf("%%PartSlab %10s%% %10s%% %10s%% %10s%%\n",
826+
printf("%%PartSlab%10s%% %10s%% %10s%% %10s%%\n",
822827
b1, b2, b3, b4);
823828

824829
store_size(b1, avg_partobj);store_size(b2, min_partobj);
@@ -830,7 +835,7 @@ void totals(void)
830835
store_size(b1, avg_ppartobj);store_size(b2, min_ppartobj);
831836
store_size(b3, max_ppartobj);
832837
store_size(b4, total_partobj * 100 / total_objects);
833-
printf("%% PartObj %10s%% %10s%% %10s%% %10s%%\n",
838+
printf("%% PartObj%10s%% %10s%% %10s%% %10s%%\n",
834839
b1, b2, b3, b4);
835840

836841
store_size(b1, avg_size);store_size(b2, min_size);
@@ -1100,6 +1105,8 @@ void output_slabs(void)
11001105
ops(slab);
11011106
else if (show_slab)
11021107
slabcache(slab);
1108+
else if (show_report)
1109+
report(slab);
11031110
}
11041111
}
11051112

0 commit comments

Comments
 (0)