Linux中的神秘内存使用情况

前端之家收集整理的这篇文章主要介绍了Linux中的神秘内存使用情况前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们在Microsoft Windows 2012 Server(Hypervisor)上运行了一些64位 Linux机箱(RHEL6),但问题相同.这些Linux客户机服务器在MS Windows Cloud(Hyper-V)中运行,具有16个主机服务器,每个服务器具有256 GB RAM.

它们从以下内存使用开始:

# free -m
             total       used       free     shared    buffers     cached
Mem:         48259        653      47606          0         19        106
-/+ buffers/cache:        527      47732
Swap:        13999          0      13999



# cat /proc/meminfo
MemTotal:       49418204 kB
MemFree:        48749868 kB
Buffers:           20080 kB
Cached:           108564 kB
SwapCached:            0 kB
Active:           149652 kB
Inactive:          98856 kB
Active(anon):     120124 kB
Inactive(anon):     1884 kB
Active(file):      29528 kB
Inactive(file):    96972 kB
Unevictable:           4 kB
Mlocked:               4 kB
SwapTotal:      14335992 kB
SwapFree:       14335992 kB
Dirty:               788 kB
Writeback:             0 kB
AnonPages:        122196 kB
Mapped:            39844 kB
Shmem:              2132 kB
Slab:              51832 kB
SReclaimable:      14696 kB
SUnreclaim:        37136 kB
KernelStack:        5656 kB
PageTables:        15840 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    39045092 kB
Committed_AS:     490856 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      131964 kB
VmallocChunk:   34359602252 kB
HardwareCorrupted:     0 kB
AnonHugePages:     28672 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        8128 kB
DirectMap2M:    50323456 kB

(由RES订购)

# top
top - 11:26:52 up 1 min,1 user,load average: 1.71,0.73,0.27
Tasks: 609 total,1 running,608 sleeping,0 stopped,0 zombie
cpu(s):  0.0%us,0.1%sy,0.0%ni,99.8%id,0.0%wa,0.1%hi,0.0%si,0.0%st
Mem:  49418204k total,674472k used,48743732k free,20472k buffers
Swap: 14335992k total,0k used,14335992k free,111720k cached

  PID USER      PR  NI  VIRT  RES  SHR S %cpu %MEM    TIME+  COMMAND
 1859 root      20   0  103m  28m 5784 S  0.0  0.1   0:00.85 Xvnc
 2037 root      20   0  508m  25m 8876 S  0.7  0.1   0:01.18 gnome-settings-
 2064 root      20   0  373m  17m  12m S  0.0  0.0   0:01.11 nautilus
 2141 root      20   0  464m  16m  12m S  0.0  0.0   0:00.14 clock-applet
 2063 root      20   0  319m  14m  10m S  0.0  0.0   0:00.28 gnome-panel
 2082 root      20   0  307m  12m 9100 S  0.0  0.0   0:00.11 nm-applet
 2139 root      20   0  381m  12m 9748 S  0.0  0.0   0:00.08 gdm-user-switch
 2093 root      20   0  442m  11m 9104 S  0.0  0.0   0:00.13 gnome-volume-co
 2116 root      20   0  299m  11m 9476 S  0.0  0.0   0:00.10 wnck-applet
 2118 root      20   0  307m  11m 8768 S  0.0  0.0   0:00.06 trashapplet
...

6分钟后,内存被未知进程或内核消耗:

uptime ; free -m
 11:31:52 up 6 min,load average: 1.05,0.93,0.47
             total       used       free     shared    buffers     cached
Mem:         48259      25296      22963          0         21        160
-/+ buffers/cache:      25115      23144
Swap:        13999          0      13999

]# cat /proc/meminfo
MemTotal:       49418204 kB
MemFree:        23514240 kB
Buffers:           21600 kB
Cached:           164428 kB
SwapCached:            0 kB
Active:           210768 kB
Inactive:         108108 kB
Active(anon):     133036 kB
Inactive(anon):     2332 kB
Active(file):      77732 kB
Inactive(file):   105776 kB
Unevictable:           8 kB
Mlocked:               8 kB
SwapTotal:      14335992 kB
SwapFree:       14335992 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:        132892 kB
Mapped:            41976 kB
Shmem:              2516 kB
Slab:              52624 kB
SReclaimable:      17628 kB
SUnreclaim:        34996 kB
KernelStack:        5752 kB
PageTables:        15756 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    39045092 kB
Committed_AS:     654848 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      131964 kB
VmallocChunk:   34359602252 kB
HardwareCorrupted:     0 kB
AnonHugePages:     45056 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        8128 kB
DirectMap2M:    50323456 kB

(由RES订购)

# top
top - 11:32:45 up 7 min,load average: 1.02,0.94,0.50
Tasks: 607 total,606 sleeping,0 zombie
cpu(s):  0.1%us,99.7%id,0.0%hi,25904096k used,23514108k free,21600k buffers
Swap: 14335992k total,164428k cached

  PID USER      PR  NI  VIRT  RES  SHR S %cpu %MEM    TIME+  COMMAND
 1859 root      20   0  103m  28m 6176 S  0.0  0.1   0:00.87 Xvnc
 2037 root      20   0  508m  25m 8916 S  0.0  0.1   0:01.19 gnome-settings-
 2064 root      20   0  373m  17m  12m S  0.0  0.0   0:01.61 nautilus
 2141 root      20   0  464m  16m  12m S  0.0  0.0   0:00.15 clock-applet
 2063 root      20   0  319m  14m  10m S  0.0  0.0   0:00.29 gnome-panel
 1788 root      20   0  779m  13m 5808 S  0.0  0.0   0:00.18 scxcimserver
 2082 root      20   0  307m  12m 9100 S  0.0  0.0   0:00.11 nm-applet
 2139 root      20   0  381m  12m 9748 S  0.0  0.0   0:00.08 gdm-user-switch
 2093 root      20   0  442m  11m 9104 S  0.0  0.0   0:00.13 gnome-volume-co
 2116 root      20   0  299m  11m 9476 S  0.0  0.0   0:00.10 wnck-applet
...

以MB为单位报告的RSS内存总和约为388:

# ps aux | awk '{sum+=$6} END {print sum / 1024}'
387.898

还有什么可以检查以找出消耗内存的内容

解决方法

听起来Hyper-V正在窃取内存,因为主机过度配置,这个过程称为 memory ballooning(或Hyper-V世界中的动态内存).
原文链接:https://www.f2er.com/linux/398038.html

猜你在找的Linux相关文章