Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux 5, 6 and 7
Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux 5, 6 and 7
Environment
- Red Hat Enterprise Linux (RHEL) 5
- Red Hat Enterprise Linux (RHEL) 6
- Red Hat Enterprise Linux (RHEL) 7
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 has an additional field called
MemAvailable
in/proc/meminfo
- RHEL 7 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):
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 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 and 7.0.
free output |
coresponding /proc/meminfo fields |
---|---|
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
RHEL 5, RHEL 6 and RHEL 7
- 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.)
RHEL 7 only
- MemAvailable: An estimate of how much memory is available for starting new applications, without swapping.
Detailed Level statistics
RHEL 5, RHEL 6 and RHEL 7
- 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
RHEL 6 and RHEL 7 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
RHEL 5, RHEL 6 and RHEL 7
- 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 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 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)
RHEL 6 and RHEL 7 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 byvm.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)
A quick rundown on /proc’s files:
- /proc/cmdline – Kernel command line information.
- /proc/console – Information about current consoles including tty.
- /proc/devices – Device drivers currently configured for the running kernel.
- /proc/dma – Info about current DMA channels.
- /proc/fb – Framebuffer devices.
- /proc/filesystems – Current filesystems supported by the kernel.
- /proc/iomem – Current system memory map for devices.
- /proc/ioports – Registered port regions for input output communication with device.
- /proc/loadavg – System load average.
- /proc/locks – Files currently locked by kernel.
- /proc/meminfo – Info about system memory (see above example).
- /proc/misc – Miscellaneous drivers registered for miscellaneous major device.
- /proc/modules – Currently loaded kernel modules.
- /proc/mounts – List of all mounts in use by system.
- /proc/partitions – Detailed info about partitions available to the system.
- /proc/pci – Information about every PCI device.
- /proc/stat – Record or various statistics kept from last reboot.
- /proc/swap – Information about swap space.
- /proc/uptime – Uptime information (in seconds).
- /proc/version – Kernel version, gcc version, and Linux distribution installed.
Within /proc’s numbered directories you will find a few files and links. Remember that these directories’ numbers correlate to the PID of the command being run within them. Let’s use an example. On my system, there is a folder name /proc/12:
# cd /proc/12
# ls
Sample Output
attr coredump_filter io mounts oom_score_adj smaps wchan
autogroup cpuset latency mountstats pagemap stack
auxv cwd limits net personality stat
cgroup environ loginuid ns root statm
clear_refs exe maps numa_maps sched status
cmdline fd mem oom_adj schedstat syscall
comm fdinfo mountinfo oom_score sessionid task
If I run:
# cat /proc/12/status
I get the following:
Name: xenwatch
State: S (sleeping)
Tgid: 12
Pid: 12
PPid: 2
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 64
Groups:
Threads: 1
SigQ: 1/4592
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: ffffffffffffffff
SigCgt: 0000000000000000
CapInh: 0000000000000000
CapPrm: ffffffffffffffff
CapEff: ffffffffffffffff
CapBnd: ffffffffffffffff
Cpus_allowed: 1
Cpus_allowed_list: 0
Mems_allowed: 00000000,00000001
Mems_allowed_list: 0
voluntary_ctxt_switches: 84
nonvoluntary_ctxt_switches: 0
So, what does this mean? Well, the important part is at the top. We can see from the status file that this process belongs to xenwatch. Its current state is sleeping, and its process ID is 12, obviously. We also can see who is running this, as UID and GID are 0, indicating that this process belongs to the root user.
In any numbered directory, you will have a similar file structure. The most important ones, and their descriptions, are as follows:
- cmdline – command line of the process
- environ – environmental variables
- fd – file descriptors
- limits – contains information about the limits of the process
- mounts – related information
You will also notice a number of links in the numbered directory:
- cwd – a link to the current working directory of the process
- exe – link to the executable of the process
- root – link to the work directory of the process
This should get you started with familiarizing yourself with the /proc directory. It should also provide insight to how a number of commands obtain their info, such as uptime, lsof, mount, and ps, just to name a few.
Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux 5, 6 and 7的更多相关文章
- How to use, monitor, and disable transparent hugepages in Red Hat Enterprise Linux 6
Resolution Note: Transparent Huge Pages are not available on the 32-bit version of RHEL 6. Transpare ...
- Red Hat Enterprise Linux 6.4常用命令
常用命令: profile文件立即生效:source /etc/profile source /home/kituser/.bash_profile 修改文件夹子文件权限:chmod -R 777 / ...
- ORACLE Install (10g r2) FOR Red Hat Enterprise Linux Server release 5.5 (64 bit) (转)
OS Info----------# cat /etc/redhat-releaseRed Hat Enterprise Linux Server release 5.5 (Tikanga)# cat ...
- setting up a IPSEC/L2TP vpn on CentOS 6 or Red Hat Enterprise Linux 6 or Scientific Linux
This is a guide on setting up a IPSEC/L2TP vpn on CentOS 6 or Red Hat Enterprise Linux 6 or Scientif ...
- Common administrative commands in Red Hat Enterprise Linux 5, 6, and 7
https://access.redhat.com/articles/1189123 Common administrative commands in Red Hat Enterprise Linu ...
- Deploy Oracle 10.2.0.5 DataGuard on Red Hat Enterprise Linux 6.4
系统:Red Hat Enterprise Linux 6.4 数据库:Oracle 10.2.0.5.0 Patch Set 4 主机:10dg1 192.168.1.91 10dg2192.168 ...
- How to disable transparent hugepages (THP) on Red Hat Enterprise Linux 7
How to disable transparent hugepages (THP) on Red Hat Enterprise Linux 7 $ Solution 已验证 - 已更新2017年六月 ...
- How to create Oracle ASM devices using device-mapper multipath devices in Red Hat Enterprise Linux 6
How to create Oracle ASM devices using device-mapper multipath devices in Red Hat Enterprise Linux 6 ...
- How to rebuild RPM database on a Red Hat Enterprise Linux system?
本文是笔者最近遇到的一个故障的处理过程,解决方案是Rebuild RPM 的DB,后面内容其实是REDHAT官方的solutions,不过我遇到的现象和解决方案都与官方有点出入,故一直帖出来: 我遇到 ...
随机推荐
- WPF绑定的ListBox获取ListBoxItem及GoToState应用
现公司项目中需要制作一个扇形菜单,菜单项是用ListBox重写Style实现的,其数据是绑定的.菜单的每一项都有Normal,MouseOver和Selected三种状态,这三种状态当然可以通过鼠标移 ...
- [机器学习] 训练集(train set) 验证集(validation set) 测试集(test set)
在有监督(supervise)的机器学习中,数据集常被分成2~3个即: 训练集(train set) 验证集(validation set) 测试集(test set) 一般需要将样本分成独立的三部分 ...
- SpringBoot学习(二)——Spring的Java配置方式
Java配置是Spring4.x推荐的配置方式,可以完全替代xml配置. 一.@Configuration 和 @Bean Spring的Java配置方式是通过@Configuration和@Bean ...
- 分布式理论(四)—— 一致性协议之 3PC
前言 我们说为了实现 BASE 理论,需要在可用性和一致性之间找到一个合适的一致性理论,于是,我们在上篇文章中了解了 2PC 理论,也就是两阶段提交,二阶段提交原理简单,实现方便,但是缺点则是同步阻塞 ...
- 并发编程——详解 AQS CLH 锁
从 acquire 方法开始 -- 获取 为什么 AQS 需要一个虚拟 head 节点 reelase 方法如何释放锁 总结 前言 AQS 是 JUC 中的核心,其中封装了资源的获取和释放,在我们之前 ...
- ASP.NET开发,从二层至三层,至面向对象 (2)
继续上一篇<ASP.NET开发,从二层至三层,至面向对象>http://www.cnblogs.com/insus/p/3822624.html .我们了解到怎样把自己的程序由二层变为三层 ...
- AngularJS学习笔记(一)走近AngularJS
什么是AngularJS AngularJS是一款优秀的前端JS框架,是Google多款产品之一,简称ng. ng有着诸多特性,最为核心的是:MVVM.模块化.自动化双向数据绑定.语义化标签.依赖注入 ...
- Elasticsearch Query DSL 整理总结(二)—— 要搞懂 Match Query,看这篇就够了
目录 引言 构建示例 match operator 参数 analyzer lenient 参数 Fuzziness fuzzniess 参数 什么是模糊搜索? Levenshtein Edit Di ...
- Java面试题—初级(9)
139. Java中的泛型是什么 ? 使用泛型的好处是什么? 泛型是Java SE 1.5的新特性,泛型的本质是参数化类型,也就是说所操作的数据类型被指定为一个参数. 好处: 1.类型安全,提供编译期 ...
- 使用spring的JavaMail发送邮件
以前我们使用JavaMail发送邮件,步骤挺多的.现在的项目跟Spring整合的比较多.所以这里主要谈谈SpringMail发送. 导入jar包. 配置applicationContext-email ...