Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux
Environment
- Red Hat Enterprise Linux (All Versions)
Issue
- I need an interpretation of
/proc/meminfo
output. - I want to compare the output of
free -k
tocat /proc/meminfo
.
Resolution
- For definition of
/proc/meminfo
fields in Red Hat Enterprise Linux (RHEL) releases prior to RHEL 5, please look at What is indicated by each value in /proc/meminfo? - Each field of
cat /proc/meminfo
will be discussed in the Diagnostics Steps. - The RHEL 5 output differs in some settings. This is also marked in the Diagnostic Steps.
- RHEL 5 also has some fields no longer present in RHEL 6. For explanation on this issue have a look at Why are LowTotal, LowFree, HighTotal, and HighFree missing from /proc/meminfo on x86_64 RHEL 6?
- For more information on the output of the
free
command see How do I view system memory utilization in Red Hat Enterprise Linux? - RHEL 7 and later has an additional field called
MemAvailable
in/proc/meminfo
- RHEL 7 and later has a slightly changed output of the
free
command
Comparing the output
free -k
output (RHEL 5 and RHEL 6):
total used free shared buffers cached
Mem: 7778104 2971960 4806144 0 211756 1071092
-/+ buffers/cache: 1689112 6088992
Swap: 4194296 0 4194296
free -k
output (RHEL 7 and later):
total used free shared buff/cache available
Mem: 1012952 252740 158732 11108 601480 543584
Swap: 1048572 5380 1043192
- Relevant fields from
/proc/meminfo
to match them against the output offree -k
:
MemTotal: 7778104 kB
MemFree: 4806144 kB
Buffers: 211756 kB
Cached: 1071092 kB
SwapTotal: 4194296 kB
SwapFree: 4194296 kB
- For RHEL 7 and later, there is an additional field available, which is used instead of the calculation for
-/+ buffers/cache
line:
MemAvailable: 543584 kB
Matching output of free -k
to /proc/meminfo
The following table shows how to get the free
output matched to the /proc/meminfo
fields in Red Hat Enterprise Linux 5, 6, 7, 8 & 9.
free output |
coresponding /proc/meminfo fields |
---|---|
Mem: total |
MemTotal |
Mem: used |
MemTotal - MemFree [1] |
Mem: free |
MemFree |
Mem: shared (can be ignored nowadays. It has no meaning.) |
N/A |
Mem: buffers |
Buffers |
Mem: cached |
Cached |
-/+ buffers/cache: used |
MemTotal - (MemFree + Buffers + Cached) [1] |
-/+ buffers/cache: free |
MemFree + Buffers + Cached |
Swap: total |
SwapTotal |
Swap: used |
SwapTotal - SwapFree |
Swap: free |
SwapFree |
The following table shows how to get the free
output matched to the /proc/meminfo
fields in Red Hat Enterprise Linux 7.1 or later (procps-ng 3.3.10).
[1] Note the used
in free output
is calculated by MemTotal - MemAvailable
since RHEL9.1.
free output |
coresponding /proc/meminfo fields |
---|---|
Mem: total |
MemTotal |
Mem: used |
MemTotal - MemFree - Buffers - Cached - Slab |
Mem: free |
MemFree |
Mem: shared |
Shmem |
Mem: buff/cache |
Buffers + Cached + Slab |
Mem:available |
MemAvailable |
Swap: total |
SwapTotal |
Swap: used |
SwapTotal - SwapFree |
Swap: free |
SwapFree |
Root Cause
- Analyzing memory consumption
Diagnostic Steps
Most stuff is taken from the kernel documentation (Documentation/filesystems/proc.txt
and Documentation/vm/hugetlbpage.txt
)
High Level statistics
RHEL 5, 6, 7, 8 & 9.
MemTotal:
Total usable memoryMemFree:
The amount of physical memory not used by the systemBuffers:
Memory in buffer cache, so relatively temporary storage for raw disk blocks. This shouldn't get very large.Cached:
Memory in the pagecache (Diskcache and Shared Memory)SwapCached:
Memory that is present within main memory, but also in the swapfile. (If memory is needed this area does not need to be swapped out AGAIN because it is already in the swapfile. This saves I/O and increases performance if machine runs short on memory.)
RHEL 7, 8 & 9 only
MemAvailable:
An estimate of how much memory is available for starting new applications, without swapping.- For further information about
MemAvailable
, please check here.
- For further information about
Detailed Level statistics
RHEL 5, 6, 7, 8 & 9.
Active:
Memory that has been used more recently and usually not swapped out or reclaimedInactive:
Memory that has not been used recently and can be swapped out or reclaimed
RHEL 6, 7, 8 & 9.
Active(anon):
Anonymous memory that has been used more recently and usually not swapped outInactive(anon):
Anonymous memory that has not been used recently and can be swapped outActive(file):
Pagecache memory that has been used more recently and usually not reclaimed until neededInactive(file):
Pagecache memory that can be reclaimed without huge performance impactUnevictable:
Unevictable pages can't be swapped out for a variety of reasonsMlocked:
Pages locked to memory using themlock()
system call. Mlocked pages are also Unevictable.
Memory statistics
RHEL 5, 6, 7, 8 & 9.
SwapTotal:
Total swap space availableSwapFree:
The remaining swap space availableDirty:
Memory waiting to be written back to diskWriteback:
Memory which is actively being written back to diskAnonPages:
Non-file backed pages mapped into userspace page tablesMapped:
Files which have been mmaped, such as librariesSlab:
In-kernel data structures cachePageTables:
Amount of memory dedicated to the lowest level of page tables. This can increase to a high value if a lot of processes are attached to the same shared memory segment.NFS_Unstable:
NFS pages sent to the server, but not yet commited to the storageBounce:
Memory used for block devicebounce buffers
CommitLimit:
Based on the overcommit ratio (vm.overcommit_ratio
), this is the total amount of memory currently available to be allocated on the system. This limit is only adhered to if strict overcommit accounting is enabled (mode 2 invm.overcommit_memory
).Committed_AS:
The amount of memory presently allocated on the system. The committed memory is a sum of all of the memory which has been allocated by processes, even if it has not been "used" by them as of yet.VmallocTotal:
total size of vmalloc memory areaVmallocUsed:
amount of vmalloc area which is usedVmallocChunk:
largest contiguous block of vmalloc area which is freeHugePages_Total:
Number of hugepages being allocated by the kernel (Defined withvm.nr_hugepages
)HugePages_Free:
The number of hugepages not being allocated by a processHugePages_Rsvd:
The number of hugepages for which a commitment to allocate from the pool has been made, but no allocation has yet been made.Hugepagesize:
The size of ahugepage
(usually 2MB on an Intel based system)
Red Hat Enterprise Linux 7, 8, 9
Percpu:
The amount of memory dedicated to per-cpu objects. For scalability and memory access speed optimization, many kernel-specific objects were broken down in such a way to have a copy of that object for each CPU on the system (per-cpu). These objects can be statically allocated on boot or dynamically allocated while the system is running; cgroups, for example, often create dynamic per-cpu object allocations.
RHEL 9
CmaTotal:
Total amount of Contiguous Memory Area reserved for current kernel.CmaFree:
Contiguous Memory Area that is free to use by current kernel.
NOTE: New parameters added in /proc/meminfo of RHEL 9
as CmaTotal
& CmaFree
RHEL 6, 7, 8 & 9.
Shmem:
Total used shared memory (shared between several processes, thus including RAM disks, SYS-V-IPC and BSD like SHMEM)SReclaimable:
The part of the Slab that might be reclaimed (such as caches)SUnreclaim:
The part of the Slab that can't be reclaimed under memory pressureKernelStack:
The memory the kernel stack uses. This is not reclaimable.WritebackTmp:
Memory used by FUSE for temporary writeback buffersHardwareCorrupted:
The amount of RAM the kernel identified as corrupted / not workingAnonHugePages:
Non-file backed huge pages mapped into userspace page tablesHugePages_Surp:
The number of hugepages in the pool above the value invm.nr_hugepages
. The maximum number of surplus hugepages is controlled byvm.nr_overcommit_hugepages
.DirectMap4k:
The amount of memory being mapped into the kernel space with 4k size pages.DirectMap2M:
The amount of memory being mapped into the kernel space with 2MB size pages.DirectMap1G.
The amount of memory being mapped into the kernel space with 1GB size pages.
NOTE for DirectMap*
: All RAM maps directly into the kernel space in 64bit architecture. If possible, the kernel uses larger size pages for improving the effectiveness of TLB. So the sum of DirectMap*
should be constant if the amount of RAM is not changed, and most memory is counted on DirectMap1G
and/or DirectMap2M
. This is not related to hugepages
.
NOTE for DirectMap1G
: This value will only be available in /proc/meminfo
provided the respective CPU hardware supports it. You can verify the same by checking for flag 'pdpe1gb' in /proc/cpuinfo
.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments