Understanding Linux vmstat Virtual Memory Data

The vmstat (Virtual Memory Statistics) tool is a lightweight command-line utility used in Linux to monitor and report system resource usage. This article details the specific virtual memory metrics gathered by vmstat, explaining how the tool measures physical memory, swap utilization, memory paging events, and kernel slab structures to help diagnose performance bottlenecks.

Core Memory Fields

When executed without additional flags, vmstat displays standard columns grouped under distinct headers. The memory section details the current state of physical and swap allocation:

Using the -a (active/inactive) flag replaces buff and cache with:

Swapping Metrics

The swap section directly tracks paging traffic between physical RAM and the disk:

Summary Statistics (vmstat -s)

Running vmstat -s outputs a detailed breakdown of event counters and cumulative memory statistics derived from /proc/meminfo and /proc/vmstat:

Kernel Slab Utilization (vmstat -m)

With the -m switch, vmstat gathers slab allocation statistics directly from /proc/slabinfo. This provides information about kernel-level virtual memory objects, such as directory entries (dentry), file system inodes, and buffer heads, detailing how many instances of each kernel object currently occupy memory.