$ free -h total used free shared buff/cache available Mem: 125G 12G 347M 9.3M 113G 113G Swap: 0B 0B 0B
free命令直接将buff和cache写到了一块,说明两者有很多共同点。
1 2 3 4 5
$ vmstat 1 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 7 1 0 364076 18664 118624552 0 0 214 11198 106 118 6 4 89 1 0 13 1 0 349096 18664 118638192 0 0 0 1012404 171031 270124 20 13 66 2 0
而通过vmstat命令可以分别看到buffer和cache的大小,单位为KB。
使用man free命令看到的解释如下:
1 2 3
buffers: Memory used by kernel buffers (Buffers in /proc/meminfo)
cache: Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
查看proc的man手册结果如下:
1 2 3 4 5 6 7 8 9 10 11
Buffers %lu Relatively temporary storage for raw disk blocks that shouldn't get tremendously large (20MB or so).
Cached %lu In-memory cache for files read from the disk (the pagecache). Doesn't include SwapCached.
SReclaimable %lu (since Linux 2.6.19) Part of Slab, that might be reclaimed, such as caches.
SUnreclaim %lu (since Linux 2.6.19) Part of Slab, that cannot be reclaimed on memory pressure.