Proc-meminfo

From NovaOrdis Knowledge Base
Revision as of 22:14, 4 August 2016 by Ovidiu (talk | contribs) (→‎Cached)
Jump to navigation Jump to search

External

Internal

Overview

Provides physical memory statistics. On Mac, similar information can be obtained with vm_stat. Swap statistics are provided by /proc/swaps.

top, free and ps commands use the information from /proc/meminfo

In the context, 1 kB = 1024 bytes.

cat /proc/meminfo 

MemTotal:        1015944 kB
MemFree:          809428 kB
MemAvailable:     798524 kB
Buffers:             700 kB
Cached:            87828 kB
SwapCached:            0 kB
Active:            76496 kB
Inactive:          64576 kB
Active(anon):      52636 kB
Inactive(anon):    12836 kB
Active(file):      23860 kB
Inactive(file):    51740 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         52576 kB
Mapped:            21884 kB
Shmem:             12928 kB
Slab:              38104 kB
SReclaimable:      15212 kB
SUnreclaim:        22892 kB
KernelStack:        2400 kB
PageTables:         3628 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      507972 kB
Committed_AS:     286868 kB
VmallocTotal:   34359738367 kB
VmallocUsed:        3460 kB
VmallocChunk:   34359734271 kB
HardwareCorrupted:     0 kB
AnonHugePages:     10240 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:       49152 kB
DirectMap2M:      999424 kB

Content

MemTotal

Total amount of usable RAM, which is the amount of physical RAM installed on the system minus a number of reserved bits and the kernel binary code.

https://github.com/NovaOrdis/os-stats/blob/master/src/main/java/io/novaordis/osstats/metric/memory/MemTotal.java

The same value is returned by top "total" physical memory summary.

MemFree

The amount of physical RAM, left unused by the system.

https://github.com/NovaOrdis/os-stats/blob/master/src/main/java/io/novaordis/osstats/metric/memory/MemFree.java

The same value is returned by top "free" physical memory summary.

Buffers

The amount of physical memory temporary storage for raw disk blocks.

Buffers and Cached are reported together by top.

Cached

The amount of physical memory used as cache memory.

Physical Memory Available to Processes

The amount of physical memory available to processes can be approximated with the formula:

Available Physical Memory = MemTotal - MemFree - Buffers - Cached


SwapCached — The amount of memory, in kibibytes, that has once been moved into swap, then back into the main memory, but still also remains in the swapfile. This saves I/O, because the memory does not need to be moved into swap again. Active — The amount of memory, in kibibytes, that has been used more recently and is usually not reclaimed unless absolutely necessary. Inactive — The amount of memory, in kibibytes, that has been used less recently and is more eligible to be reclaimed for other purposes. Active(anon) — The amount of anonymous and tmpfs/shmem memory, in kibibytes, that is in active use, or was in active use since the last time the system moved something to swap. Inactive(anon) — The amount of anonymous and tmpfs/shmem memory, in kibibytes, that is a candidate for eviction. Active(file) — The amount of file cache memory, in kibibytes, that is in active use, or was in active use since the last time the system reclaimed memory. Inactive(file) — The amount of file cache memory, in kibibytes, that is newly loaded from the disk, or is a candidate for reclaiming. Unevictable — The amount of memory, in kibibytes, discovered by the pageout code, that is not evictable because it is locked into memory by user programs. Mlocked — The total amount of memory, in kibibytes, that is not evictable because it is locked into memory by user programs.

SwapTotal

The total amount of swap available.

SwapFree

The total amount of swap free.

Dirty — The total amount of memory, in kibibytes, waiting to be written back to the disk. Writeback — The total amount of memory, in kibibytes, actively being written back to the disk. AnonPages — The total amount of memory, in kibibytes, used by pages that are not backed by files and are mapped into userspace page tables. Mapped — The memory, in kibibytes, used for files that have been mmaped, such as libraries. Shmem — The total amount of memory, in kibibytes, used by shared memory (shmem) and tmpfs. Slab — The total amount of memory, in kibibytes, used by the kernel to cache data structures for its own use. SReclaimable — The part of Slab that can be reclaimed, such as caches. SUnreclaim — The part of Slab that cannot be reclaimed even when lacking memory. KernelStack — The amount of memory, in kibibytes, used by the kernel stack allocations done for each task in the system. PageTables — The total amount of memory, in kibibytes, dedicated to the lowest page table level. NFS_Unstable — The amount, in kibibytes, of NFS pages sent to the server but not yet committed to the stable storage. Bounce — The amount of memory, in kibibytes, used for the block device "bounce buffers". WritebackTmp — The amount of memory, in kibibytes, used by FUSE for temporary writeback buffers. CommitLimit — The total amount of memory currently available to be allocated on the system based on the overcommit ratio (vm.overcommit_ratio). This limit is only adhered to if strict overcommit accounting is enabled (mode 2 in vm.overcommit_memory). CommitLimit is calculated with the following formula:

([total RAM pages] - [total huge TLB pages]) * overcommit_ratio

───────────────────────────────────────────────────────────────── + [total swap pages]

                          100

For example, on a system with 1 GB of physical RAM and 7 GB of swap with a vm.overcommit_ratio of 30 it would yield a CommitLimit of 7.3 GB. Committed_AS — The total amount of memory, in kibibytes, estimated to complete the workload. This value represents the worst case scenario value, and also includes swap memory. VMallocTotal — The total amount of memory, in kibibytes, of total allocated virtual address space. VMallocUsed — The total amount of memory, in kibibytes, of used virtual address space. VMallocChunk — The largest contiguous block of memory, in kibibytes, of available virtual address space. HardwareCorrupted — The amount of memory, in kibibytes, with physical memory corruption problems, identified by the hardware and set aside by the kernel so it does not get used. AnonHugePages — The total amount of memory, in kibibytes, used by huge pages that are not backed by files and are mapped into userspace page tables. HugePages_Total — The total number of hugepages for the system. The number is derived by dividing Hugepagesize by the megabytes set aside for hugepages specified in /proc/sys/vm/hugetlb_pool. This statistic only appears on the x86, Itanium, and AMD64 architectures. HugePages_Free — The total number of hugepages available for the system. This statistic only appears on the x86, Itanium, and AMD64 architectures. HugePages_Rsvd — The number of unused huge pages reserved for hugetlbfs. HugePages_Surp — The number of surplus huge pages. Hugepagesize — The size for each hugepages unit in kibibytes. By default, the value is 4096 KB on uniprocessor kernels for 32 bit architectures. For SMP, hugemem kernels, and AMD64, the default is 2048 KB. For Itanium architectures, the default is 262144 KB. This statistic only appears on the x86, Itanium, and AMD64 architectures. DirectMap4k — The amount of memory, in kibibytes, mapped into kernel address space with 4 kB page mappings. DirectMap2M — The amount of memory, in kibibytes, mapped into kernel address space with 2 MB page mappings.