我们配置了一台新服务器,但内存使用率很高,在 htop / top 或 python 内存脚本中都找不到有关使用情况的信息(http://www.pixelbeat.org/scripts/ps_mem.py)。以下是 free -m 的输出:
total used free shared buffers cached
Mem: 7195 1347 5848 0 3 28
-/+ buffers/cache: 1315 5879
Swap: 3813 0 3813
从顶部开始,按内存使用情况排序:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1586 root 20 0 200m 14m 1836 S 0 0.2 0:00.75 xend
1585 root 20 0 95892 9.9m 832 S 0 0.1 0:00.00 xend
1855 root 20 0 51728 2996 2368 S 0 0.0 0:00.00 sshd
1822 ntp 20 0 38332 2176 1596 S 0 0.0 0:00.03 ntpd
1858 psadmin 20 0 17728 1932 1436 S 0 0.0 0:00.00 bash
1071 root 20 0 52416 1852 1032 S 0 0.0 0:00.02 rsyslogd
1857 psadmin 20 0 51880 1396 756 S 0 0.0 0:00.00 sshd
1866 psadmin 20 0 19064 1364 1000 R 0 0.0 0:00.04 top
1564 root 20 0 49168 1140 592 S 0 0.0 0:00.00 sshd (etc)
前面提到的 Python 脚本说明了哪些应用程序正在使用哪些:
Private + Shared = RAM used Program
180.0 KiB + 71.5 KiB = 251.5 KiB xenconsoled
228.0 KiB + 32.0 KiB = 260.0 KiB acpid
204.0 KiB + 58.0 KiB = 262.0 KiB init
252.0 KiB + 75.5 KiB = 327.5 KiB cron
332.0 KiB + 44.0 KiB = 376.0 KiB dbus-daemon
380.0 KiB + 53.5 KiB = 433.5 KiB xenstored
556.0 KiB + 138.0 KiB = 694.0 KiB sudo
612.0 KiB + 255.0 KiB = 867.0 KiB getty (6)
604.0 KiB + 582.0 KiB = 1.2 MiB udevd (3)
1.1 MiB + 103.5 KiB = 1.2 MiB rsyslogd
956.0 KiB + 267.5 KiB = 1.2 MiB ntpd
1.2 MiB + 73.0 KiB = 1.3 MiB bash
1.5 MiB + 1.3 MiB = 2.8 MiB sshd (3)
16.2 MiB + 3.8 MiB = 20.0 MiB xend (2)
---------------------------------
31.0 MiB
=================================
Private + Shared = RAM used Program
因此,实际上有两个问题:
1) 该 RAM 用来做什么?
2)为什么我安装的 8GB RAM 只有 7195MB?
这是在 Dell Poweredge R210 上,带有 RAID0 中的 SAS 驱动器。
任何帮助都将不胜感激!
答案1
事实证明这是这里看到的同一个问题:Debian Squeeze 和可用内存(缺少 1GB),Xen 内核使得~1GB '缺失',如图所示dmesg
。
更新了问题的具体内容:Debian Squeeze 上的 Xen 内核导致 1GB 内存“缺失”
答案2
答案3
问题 1
不要恐慌!
它正用于文件缓存缓冲区。Linux 将不断缓存从硬盘读取的文件以提高性能。不用担心,只要内存需要用于其他用途,它就会转储缓存并将内存提供给正在运行的进程。当您运行 free -m 时,它实际上会告诉您这一点:
- 总内存使用量为 1347
- 缓冲区/缓存使用的内存为 1315
基本上它正在做它应该做的事情。
问题2
这很可能是由于显卡使用内存,请检查您的 BIOS 以查看是否有为 GPU 分配特定数量内存的设置。
答案4
说实话,我不知道。
http://www.mjmwired.net/kernel/Documentation/IO-mapping.txt
127 NOTE NOTE NOTE! The above is only one part of the whole equation. The above
128 only talks about "real memory", that is, CPU memory (RAM).
129
130 There is a completely different type of memory too, and that's the "shared
131 memory" on the PCI or ISA bus. That's generally not RAM (although in the case
132 of a video graphics card it can be normal DRAM that is just used for a frame
133 buffer), but can be things like a packet buffer in a network card etc.
134
135 This memory is called "PCI memory" or "shared memory" or "IO memory" or
136 whatever, and there is only one way to access it: the readb/writeb and
137 related functions. You should never take the address of such memory, because
138 there is really nothing you can do with such an address: it's not
139 conceptually in the same memory space as "real memory" at all, so you cannot
140 just dereference a pointer. (Sadly, on x86 it _is_ in the same memory space,
141 so on x86 it actually works to just deference a pointer, but it's not
142 portable).
-- 尝试完全禁用帧缓冲区。看看是否有任何作用。
如果这还不够神秘的话,你可以继续深入了解: