tools/mm/slabinfo.c
Source file repositories/reference/linux-study-clean/tools/mm/slabinfo.c
File Facts
- System
- Linux kernel
- Corpus path
tools/mm/slabinfo.c- Extension
.c- Size
- 38937 bytes
- Lines
- 1548
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdio.hstdlib.hsys/types.hdirent.hstrings.hstring.hunistd.hstdarg.hgetopt.hregex.herrno.h
Detected Declarations
struct slabinfostruct aliasinfofunction fatalfunction usagefunction read_objfunction get_objfunction get_obj_and_strfunction set_objfunction read_slab_objfunction read_debug_slab_objfunction store_sizefunction decode_numa_listfunction slab_validatefunction slab_shrinkfunction first_linefunction slab_sizefunction slab_activityfunction slab_wastefunction slab_numafunction show_trackingfunction opsfunction slab_statsfunction reportfunction slabcachefunction debug_opt_scanfunction slab_emptyfunction slab_debugfunction totalsfunction sort_slabsfunction sort_aliasesfunction link_slabsfunction aliasfunction rename_slabsfunction slab_mismatchfunction read_slab_dirfunction output_slabsfunction _xtotalsfunction xtotalsfunction main
Annotated Snippet
struct slabinfo {
char *name;
int alias;
int refs;
int aliases, align, cache_dma, cpu_slabs, destroy_by_rcu;
unsigned int hwcache_align, object_size, objs_per_slab;
unsigned int sanity_checks, slab_size, store_user, trace;
int order, poison, reclaim_account, red_zone;
unsigned long partial, objects, slabs, objects_partial, total_objects;
unsigned long alloc_fastpath, alloc_slowpath;
unsigned long free_fastpath, free_slowpath;
unsigned long free_frozen, free_add_partial, free_remove_partial;
unsigned long alloc_from_partial, alloc_slab, free_slab, alloc_refill;
unsigned long cpuslab_flush, deactivate_full, deactivate_empty;
unsigned long deactivate_to_head, deactivate_to_tail;
unsigned long deactivate_remote_frees, order_fallback;
unsigned long cmpxchg_double_cpu_fail, cmpxchg_double_fail;
unsigned long alloc_node_mismatch, deactivate_bypass;
unsigned long cpu_partial_alloc, cpu_partial_free;
int numa[MAX_NODES];
int numa_partial[MAX_NODES];
} slabinfo[MAX_SLABS];
struct aliasinfo {
char *name;
char *ref;
struct slabinfo *slab;
} aliasinfo[MAX_ALIASES];
int slabs;
int actual_slabs;
int aliases;
int alias_targets;
int highest_node;
char buffer[4096];
int show_empty;
int show_report;
int show_alias;
int show_slab;
int skip_zero = 1;
int show_numa;
int show_track;
int show_first_alias;
int validate;
int shrink;
int show_inverted;
int show_single_ref;
int show_totals;
int sort_size;
int sort_active;
int set_debug;
int show_ops;
int sort_partial;
int show_activity;
int output_lines = -1;
int sort_loss;
int extended_totals;
int show_bytes;
int unreclaim_only;
/* Debug options */
int sanity;
int redzone;
int poison;
int tracking;
int tracing;
int page_size;
regex_t pattern;
static void fatal(const char *x, ...)
{
va_list ap;
va_start(ap, x);
vfprintf(stderr, x, ap);
va_end(ap);
exit(EXIT_FAILURE);
}
static void usage(void)
{
printf("slabinfo 4/15/2011. (c) 2007 sgi/(c) 2011 Linux Foundation.\n\n"
"slabinfo [-aABDefhilLnoPrsStTUvXz1] [N=K] [-dafzput] [slab-regexp]\n"
"-a|--aliases Show aliases\n"
"-A|--activity Most active slabs first\n"
"-B|--Bytes Show size in bytes\n"
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `sys/types.h`, `dirent.h`, `strings.h`, `string.h`, `unistd.h`, `stdarg.h`.
- Detected declarations: `struct slabinfo`, `struct aliasinfo`, `function fatal`, `function usage`, `function read_obj`, `function get_obj`, `function get_obj_and_str`, `function set_obj`, `function read_slab_obj`, `function read_debug_slab_obj`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.