CentOS系统内存 /proc/meminfo
Redhat/Centos /proc/meminfo各参数详细解释,如下
• MemTotal Total amount of usable RAM, in kibibytes, which is physical RAM minus a number of reserved bits and the kernel binary code.
MemFree — The amount of physical RAM, in kibibytes, left unused by the system.
Buffers — The amount, in kibibytes, of temporary storage for raw disk blocks.
Cached — The amount of physical RAM, in kibibytes, used as cache memory.
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, in kibibytes.
SwapFree — The total amount of swap free, in kibibytes.
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.
来自 <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-meminfo>
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 and 7/8.
free -k 与之对应/proc/meminfo字段
Mem: total MemTotal
Mem: used MemTotal - MemFree
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)
-/+ 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).
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
1. RHEL 5, RHEL 6 and RHEL 7/8
• MemTotal: Total usable memory
• MemFree: The amount of physical memory not used by the system
• Buffers: 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.)
2. RHEL 7 only
• MemAvailable: An estimate of how much memory is available for starting new applications, without swapping.
○ For further information about MemAvailable, please check here.
Detailed Level statistics
1. RHEL 5, RHEL 6 and RHEL 7/8
• Active: Memory that has been used more recently and usually not swapped out or reclaimed
• Inactive: Memory that has not been used recently and can be swapped out or reclaimed
2. RHEL 6 and RHEL 7/8 only
• Active(anon): Anonymous memory that has been used more recently and usually not swapped out
• Inactive(anon): Anonymous memory that has not been used recently and can be swapped out
• Active(file): Pagecache memory that has been used more recently and usually not reclaimed until needed
• Inactive(file): Pagecache memory that can be reclaimed without huge performance impact
• Unevictable: Unevictable pages can't be swapped out for a variety of reasons
• Mlocked: Pages locked to memory using the mlock() system call. Mlocked pages are also Unevictable.
Memory statistics
1. RHEL 5, RHEL 6 and RHEL 7/8
• SwapTotal: Total swap space available
• SwapFree: The remaining swap space available
• Dirty: Memory waiting to be written back to disk
• Writeback: Memory which is actively being written back to disk
• AnonPages: Non-file backed pages mapped into userspace page tables
• Mapped: Files which have been mmaped, such as libraries
• Slab: In-kernel data structures cache
• PageTables: 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 storage
• Bounce: Memory used for block device bounce 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 in vm.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 area
• VmallocUsed: amount of vmalloc area which is used
• VmallocChunk: largest contiguous block of vmalloc area which is free
• HugePages_Total: Number of hugepages being allocated by the kernel (Defined with vm.nr_hugepages)
• HugePages_Free: The number of hugepages not being allocated by a process
• HugePages_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 a hugepage (usually 2MB on an Intel based system)
2. RHEL 6 and RHEL 7/8 only
• 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 pressure
• KernelStack: The memory the kernel stack uses. This is not reclaimable.
• WritebackTmp: Memory used by FUSE for temporary writeback buffers
• HardwareCorrupted: The amount of RAM the kernel identified as corrupted / not working
• AnonHugePages: Non-file backed huge pages mapped into userspace page tables
• HugePages_Surp: The number of hugepages in the pool above the value in vm.nr_hugepages. The maximum number of surplus hugepages is controlled by vm.nr_overcommit_hugepages.
• DirectMap4k: The amount of memory being mapped to standard 4k pages
• DirectMap2M: The amount of memory being mapped to hugepages (usually 2MB in size)
• DirectMap1G. The amount of memory being mapped to hugepages (usually 1GB in size)
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.
来自 <https://access.redhat.com/solutions/406773>