Lines Matching full:s

130 		"-s|--shrink            Shrink slabs\n"  in usage()
131 "-S|--Size Sort by size\n" in usage()
203 static void set_obj(struct slabinfo *s, const char *name, int n) in set_obj() argument
208 snprintf(x, 100, "%s/%s", s->name, name); in set_obj()
211 fatal("Cannot write to %s\n", x); in set_obj()
217 static unsigned long read_slab_obj(struct slabinfo *s, const char *name) in read_slab_obj() argument
223 snprintf(x, 100, "%s/%s", s->name, name); in read_slab_obj()
299 static void slab_validate(struct slabinfo *s) in slab_validate() argument
301 if (strcmp(s->name, "*") == 0) in slab_validate()
304 set_obj(s, "validate", 1); in slab_validate()
307 static void slab_shrink(struct slabinfo *s) in slab_shrink() argument
309 if (strcmp(s->name, "*") == 0) in slab_shrink()
312 set_obj(s, "shrink", 1); in slab_shrink()
323 printf("Name Objects Objsize %s " in first_line()
324 "Slabs/Part/Cpu O/S O %%Fr %%Ef Flg\n", in first_line()
347 static unsigned long slab_size(struct slabinfo *s) in slab_size() argument
349 return s->slabs * (page_size << s->order); in slab_size()
352 static unsigned long slab_activity(struct slabinfo *s) in slab_activity() argument
354 return s->alloc_fastpath + s->free_fastpath + in slab_activity()
355 s->alloc_slowpath + s->free_slowpath; in slab_activity()
358 static unsigned long slab_waste(struct slabinfo *s) in slab_waste() argument
360 return slab_size(s) - s->objects * s->object_size; in slab_waste()
363 static void slab_numa(struct slabinfo *s, int mode) in slab_numa() argument
367 if (strcmp(s->name, "*") == 0) in slab_numa()
371 printf("\n%s: No NUMA information available.\n", s->name); in slab_numa()
375 if (skip_zero && !s->slabs) in slab_numa()
379 printf("\n%-21s:", mode ? "NUMA nodes" : "Slab"); in slab_numa()
387 printf("%-21s ", mode ? "All slabs" : s->name); in slab_numa()
391 store_size(b, s->numa[node]); in slab_numa()
392 printf(" %4s", b); in slab_numa()
396 printf("%-21s ", "Partial slabs"); in slab_numa()
400 store_size(b, s->numa_partial[node]); in slab_numa()
401 printf(" %4s", b); in slab_numa()
408 static void show_tracking(struct slabinfo *s) in show_tracking() argument
410 printf("\n%s: Kernel object allocation\n", s->name); in show_tracking()
412 if (read_slab_obj(s, "alloc_calls")) in show_tracking()
413 printf("%s", buffer); in show_tracking()
417 printf("\n%s: Kernel object freeing\n", s->name); in show_tracking()
419 if (read_slab_obj(s, "free_calls")) in show_tracking()
420 printf("%s", buffer); in show_tracking()
426 static void ops(struct slabinfo *s) in ops() argument
428 if (strcmp(s->name, "*") == 0) in ops()
431 if (read_slab_obj(s, "ops")) { in ops()
432 printf("\n%s: kmem_cache operations\n", s->name); in ops()
434 printf("%s", buffer); in ops()
436 printf("\n%s has no kmem_cache operations\n", s->name); in ops()
446 static void slab_stats(struct slabinfo *s) in slab_stats() argument
452 if (!s->alloc_slab) in slab_stats()
455 total_alloc = s->alloc_fastpath + s->alloc_slowpath; in slab_stats()
456 total_free = s->free_fastpath + s->free_slowpath; in slab_stats()
465 s->alloc_fastpath, s->free_fastpath, in slab_stats()
466 s->alloc_fastpath * 100 / total_alloc, in slab_stats()
467 total_free ? s->free_fastpath * 100 / total_free : 0); in slab_stats()
469 total_alloc - s->alloc_fastpath, s->free_slowpath, in slab_stats()
470 (total_alloc - s->alloc_fastpath) * 100 / total_alloc, in slab_stats()
471 total_free ? s->free_slowpath * 100 / total_free : 0); in slab_stats()
473 s->alloc_slab, s->free_slab, in slab_stats()
474 s->alloc_slab * 100 / total_alloc, in slab_stats()
475 total_free ? s->free_slab * 100 / total_free : 0); in slab_stats()
477 s->deactivate_to_head + s->deactivate_to_tail, in slab_stats()
478 s->free_add_partial, in slab_stats()
479 (s->deactivate_to_head + s->deactivate_to_tail) * 100 / total_alloc, in slab_stats()
480 total_free ? s->free_add_partial * 100 / total_free : 0); in slab_stats()
482 s->alloc_from_partial, s->free_remove_partial, in slab_stats()
483 s->alloc_from_partial * 100 / total_alloc, in slab_stats()
484 total_free ? s->free_remove_partial * 100 / total_free : 0); in slab_stats()
487 s->cpu_partial_alloc, s->cpu_partial_free, in slab_stats()
488 s->cpu_partial_alloc * 100 / total_alloc, in slab_stats()
489 total_free ? s->cpu_partial_free * 100 / total_free : 0); in slab_stats()
492 s->deactivate_remote_frees, s->free_frozen, in slab_stats()
493 s->deactivate_remote_frees * 100 / total_alloc, in slab_stats()
494 total_free ? s->free_frozen * 100 / total_free : 0); in slab_stats()
498 if (s->cpuslab_flush) in slab_stats()
499 printf("Flushes %8lu\n", s->cpuslab_flush); in slab_stats()
501 total = s->deactivate_full + s->deactivate_empty + in slab_stats()
502 s->deactivate_to_head + s->deactivate_to_tail + s->deactivate_bypass; in slab_stats()
508 s->deactivate_full, (s->deactivate_full * 100) / total); in slab_stats()
510 s->deactivate_empty, (s->deactivate_empty * 100) / total); in slab_stats()
512 s->deactivate_to_head, (s->deactivate_to_head * 100) / total); in slab_stats()
514 s->deactivate_to_tail, (s->deactivate_to_tail * 100) / total); in slab_stats()
516 s->deactivate_bypass, (s->deactivate_bypass * 100) / total); in slab_stats()
518 s->alloc_refill, (s->alloc_refill * 100) / total); in slab_stats()
520 s->alloc_node_mismatch, (s->alloc_node_mismatch * 100) / total); in slab_stats()
523 if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail) { in slab_stats()
526 s->cmpxchg_double_fail, s->cmpxchg_double_cpu_fail); in slab_stats()
530 static void report(struct slabinfo *s) in report() argument
532 if (strcmp(s->name, "*") == 0) in report()
535 printf("\nSlabcache: %-15s Aliases: %2d Order : %2d Objects: %lu\n", in report()
536 s->name, s->aliases, s->order, s->objects); in report()
537 if (s->hwcache_align) in report()
539 if (s->cache_dma) in report()
541 if (s->destroy_by_rcu) in report()
543 if (s->reclaim_account) in report()
548 printf("Object : %7d Total : %7ld Sanity Checks : %s Total: %7ld\n", in report()
549 s->object_size, s->slabs, onoff(s->sanity_checks), in report()
550 s->slabs * (page_size << s->order)); in report()
551 printf("SlabObj: %7d Full : %7ld Redzoning : %s Used : %7ld\n", in report()
552 s->slab_size, s->slabs - s->partial - s->cpu_slabs, in report()
553 onoff(s->red_zone), s->objects * s->object_size); in report()
554 printf("SlabSiz: %7d Partial: %7ld Poisoning : %s Loss : %7ld\n", in report()
555 page_size << s->order, s->partial, onoff(s->poison), in report()
556 s->slabs * (page_size << s->order) - s->objects * s->object_size); in report()
557 printf("Loss : %7d CpuSlab: %7d Tracking : %s Lalig: %7ld\n", in report()
558 s->slab_size - s->object_size, s->cpu_slabs, onoff(s->store_user), in report()
559 (s->slab_size - s->object_size) * s->objects); in report()
560 printf("Align : %7d Objects: %7d Tracing : %s Lpadd: %7ld\n", in report()
561 s->align, s->objs_per_slab, onoff(s->trace), in report()
562 ((page_size << s->order) - s->objs_per_slab * s->slab_size) * in report()
563 s->slabs); in report()
565 ops(s); in report()
566 show_tracking(s); in report()
567 slab_numa(s, 1); in report()
568 slab_stats(s); in report()
571 static void slabcache(struct slabinfo *s) in slabcache() argument
578 if (strcmp(s->name, "*") == 0) in slabcache()
581 if (unreclaim_only && s->reclaim_account) in slabcache()
585 report(s); in slabcache()
589 if (skip_zero && !show_empty && !s->slabs) in slabcache()
592 if (show_empty && s->slabs) in slabcache()
596 store_size(size_str, slab_size(s)); in slabcache()
598 store_size(size_str, slab_waste(s)); in slabcache()
599 snprintf(dist_str, 40, "%lu/%lu/%d", s->slabs - s->cpu_slabs, in slabcache()
600 s->partial, s->cpu_slabs); in slabcache()
605 if (s->aliases) in slabcache()
607 if (s->cache_dma) in slabcache()
609 if (s->hwcache_align) in slabcache()
611 if (s->poison) in slabcache()
613 if (s->reclaim_account) in slabcache()
615 if (s->red_zone) in slabcache()
617 if (s->sanity_checks) in slabcache()
619 if (s->store_user) in slabcache()
621 if (s->trace) in slabcache()
629 total_alloc = s->alloc_fastpath + s->alloc_slowpath; in slabcache()
630 total_free = s->free_fastpath + s->free_slowpath; in slabcache()
632 printf("%-21s %8ld %10ld %10ld %3ld %3ld %5ld %1d %4ld %4ld\n", in slabcache()
633 s->name, s->objects, in slabcache()
635 total_alloc ? (s->alloc_fastpath * 100 / total_alloc) : 0, in slabcache()
636 total_free ? (s->free_fastpath * 100 / total_free) : 0, in slabcache()
637 s->order_fallback, s->order, s->cmpxchg_double_fail, in slabcache()
638 s->cmpxchg_double_cpu_fail); in slabcache()
640 printf("%-21s %8ld %7d %15s %14s %4d %1d %3ld %3ld %s\n", in slabcache()
641 s->name, s->objects, s->object_size, size_str, dist_str, in slabcache()
642 s->objs_per_slab, s->order, in slabcache()
643 s->slabs ? (s->partial * 100) / s->slabs : 100, in slabcache()
644 s->slabs ? (s->objects * s->object_size * 100) / in slabcache()
645 (s->slabs * (page_size << s->order)) : 100, in slabcache()
702 static int slab_empty(struct slabinfo *s) in slab_empty() argument
704 if (s->objects > 0) in slab_empty()
711 if (s->slabs != 0) in slab_empty()
712 set_obj(s, "shrink", 1); in slab_empty()
717 static void slab_debug(struct slabinfo *s) in slab_debug() argument
719 if (strcmp(s->name, "*") == 0) in slab_debug()
722 if (sanity && !s->sanity_checks) { in slab_debug()
723 set_obj(s, "sanity", 1); in slab_debug()
725 if (!sanity && s->sanity_checks) { in slab_debug()
726 if (slab_empty(s)) in slab_debug()
727 set_obj(s, "sanity", 0); in slab_debug()
729 fprintf(stderr, "%s not empty cannot disable sanity checks\n", s->name); in slab_debug()
731 if (redzone && !s->red_zone) { in slab_debug()
732 if (slab_empty(s)) in slab_debug()
733 set_obj(s, "red_zone", 1); in slab_debug()
735 fprintf(stderr, "%s not empty cannot enable redzoning\n", s->name); in slab_debug()
737 if (!redzone && s->red_zone) { in slab_debug()
738 if (slab_empty(s)) in slab_debug()
739 set_obj(s, "red_zone", 0); in slab_debug()
741 fprintf(stderr, "%s not empty cannot disable redzoning\n", s->name); in slab_debug()
743 if (poison && !s->poison) { in slab_debug()
744 if (slab_empty(s)) in slab_debug()
745 set_obj(s, "poison", 1); in slab_debug()
747 fprintf(stderr, "%s not empty cannot enable poisoning\n", s->name); in slab_debug()
749 if (!poison && s->poison) { in slab_debug()
750 if (slab_empty(s)) in slab_debug()
751 set_obj(s, "poison", 0); in slab_debug()
753 fprintf(stderr, "%s not empty cannot disable poisoning\n", s->name); in slab_debug()
755 if (tracking && !s->store_user) { in slab_debug()
756 if (slab_empty(s)) in slab_debug()
757 set_obj(s, "store_user", 1); in slab_debug()
759 fprintf(stderr, "%s not empty cannot enable tracking\n", s->name); in slab_debug()
761 if (!tracking && s->store_user) { in slab_debug()
762 if (slab_empty(s)) in slab_debug()
763 set_obj(s, "store_user", 0); in slab_debug()
765 fprintf(stderr, "%s not empty cannot disable tracking\n", s->name); in slab_debug()
767 if (tracing && !s->trace) { in slab_debug()
769 set_obj(s, "trace", 1); in slab_debug()
771 fprintf(stderr, "%s can only enable trace for one slab at a time\n", s->name); in slab_debug()
773 if (!tracing && s->trace) in slab_debug()
774 set_obj(s, "trace", 1); in slab_debug()
779 struct slabinfo *s; in totals() local
833 for (s = slabinfo; s < slabinfo + slabs; s++) { in totals()
841 if (!s->slabs || !s->objects) in totals()
846 size = slab_size(s); in totals()
847 used = s->objects * s->object_size; in totals()
849 objwaste = s->slab_size - s->object_size; in totals()
851 percentage_partial_slabs = s->partial * 100 / s->slabs; in totals()
855 percentage_partial_objs = s->objects_partial * 100 in totals()
856 / s->objects; in totals()
861 if (s->object_size < min_objsize) in totals()
862 min_objsize = s->object_size; in totals()
863 if (s->partial < min_partial) in totals()
864 min_partial = s->partial; in totals()
865 if (s->slabs < min_slabs) in totals()
866 min_slabs = s->slabs; in totals()
873 if (s->objects < min_objects) in totals()
874 min_objects = s->objects; in totals()
877 if (s->objects_partial < min_partobj) in totals()
878 min_partobj = s->objects_partial; in totals()
883 if (s->slab_size < min_memobj) in totals()
884 min_memobj = s->slab_size; in totals()
886 if (s->object_size > max_objsize) in totals()
887 max_objsize = s->object_size; in totals()
888 if (s->partial > max_partial) in totals()
889 max_partial = s->partial; in totals()
890 if (s->slabs > max_slabs) in totals()
891 max_slabs = s->slabs; in totals()
898 if (s->objects > max_objects) in totals()
899 max_objects = s->objects; in totals()
902 if (s->objects_partial > max_partobj) in totals()
903 max_partobj = s->objects_partial; in totals()
908 if (s->slab_size > max_memobj) in totals()
909 max_memobj = s->slab_size; in totals()
911 total_partial += s->partial; in totals()
912 total_slabs += s->slabs; in totals()
916 total_objects += s->objects; in totals()
918 total_partobj += s->objects_partial; in totals()
922 total_objwaste += s->objects * objwaste; in totals()
923 total_objsize += s->objects * s->slab_size; in totals()
960 printf("Memory used: %15s # Loss : %15s MRatio:%6s%%\n", b1, b2, b3); in totals()
964 printf("# Objects : %15s # PartObj: %15s ORatio:%6s%%\n", b1, b2, b3); in totals()
974 printf("#Objects %15s %15s %15s %15s\n", in totals()
979 printf("#Slabs %15s %15s %15s %15s\n", in totals()
984 printf("#PartSlab %15s %15s %15s %15s\n", in totals()
989 printf("%%PartSlab%15s%% %15s%% %15s%% %15s%%\n", in totals()
995 printf("PartObjs %15s %15s %15s %15s\n", in totals()
1001 printf("%% PartObj%15s%% %15s%% %15s%% %15s%%\n", in totals()
1006 printf("Memory %15s %15s %15s %15s\n", in totals()
1011 printf("Used %15s %15s %15s %15s\n", in totals()
1016 printf("Loss %15s %15s %15s %15s\n", in totals()
1027 printf("Memory %15s %15s %15s\n", in totals()
1031 printf("User %15s %15s %15s\n", in totals()
1036 printf("Loss %15s %15s %15s\n", in totals()
1101 struct slabinfo *s; in link_slabs() local
1105 for (s = slabinfo; s < slabinfo + slabs; s++) in link_slabs()
1106 if (strcmp(a->ref, s->name) == 0) { in link_slabs()
1107 a->slab = s; in link_slabs()
1108 s->refs++; in link_slabs()
1111 if (s == slabinfo + slabs) in link_slabs()
1112 fatal("Unresolved alias %s\n", a->ref); in link_slabs()
1132 printf(" %s", a->name); in alias()
1136 printf("\n%-12s <- %s", a->slab->name, a->name); in alias()
1140 printf("%-15s -> %s\n", a->name, a->slab->name); in alias()
1149 struct slabinfo *s; in rename_slabs() local
1152 for (s = slabinfo; s < slabinfo + slabs; s++) { in rename_slabs()
1153 if (*s->name != ':') in rename_slabs()
1156 if (s->refs > 1 && !show_first_alias) in rename_slabs()
1159 a = find_one_alias(s); in rename_slabs()
1162 s->name = a->name; in rename_slabs()
1164 s->name = "*"; in rename_slabs()
1199 fatal("Cannot read symlink %s\n", de->d_name); in read_slab_dir()
1210 fatal("Unable to access slab %s\n", slab->name); in read_slab_dir()
1319 printf("%s%s", heading, underline); in _xtotals()
1369 { "shrink", no_argument, NULL, 's' },
1370 { "Size", no_argument, NULL, 'S'},
1404 fatal("Invalid debug option '%s'\n", optarg); in main()
1446 case 's': in main()
1449 case 'S': in main()
1477 fatal("%s: Invalid option '%c'\n", argv[0], optopt); in main()
1492 fatal("%s: Invalid pattern '%s' code %d\n", in main()