Linux – Meaning of buff/cache and avail mem in top

linuxmemorytop

Within the output of top, there are two fields, marked "buff/cache" and "avail Mem" in the memory and swap usage lines:

enter image description here

What do these two fields mean?

I've tried Googling them, but the results only bring up generic articles on top, and they don't explain what these fields signify.

Best Answer

top’s manpage doesn’t describe the fields, but free’s does:

buffers

Memory used by kernel buffers (Buffers in /proc/meminfo)

cache

Memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo)

buff/cache

Sum of buffers and cache

available

Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free)

Basically, “buff/cache” counts memory used for data that’s on disk or should end up there soon, and as a result is potentially usable (the corresponding memory can be made available immediately, if it hasn’t been modified since it was read, or given enough time, if it has); “available” measures the amount of memory which can be allocated and used without causing more swapping (see How can I get the amount of available memory portably across distributions? for a lot more detail on that).

Related Question