LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 7589|回复: 2

请教/proc/meminfo各项的含义

[复制链接]
发表于 2004-11-12 10:56:56 | 显示全部楼层 |阅读模式
比如说下面的Committed_AS是什么意思?还有cached是干吗的?
或者有什么资料讲这些的吗?
多谢了!

[root@tsp153 bye]# cat /proc/meminfo
MemTotal:       517160 kB
MemFree:        275864 kB
Buffers:        156204 kB
Cached:          25940 kB
SwapCached:       5064 kB
Active:          81720 kB
Inactive:       108148 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       517160 kB
LowFree:        275864 kB
SwapTotal:     1020116 kB
SwapFree:       985076 kB
Dirty:              80 kB
Writeback:           0 kB
Mapped:           4444 kB
Slab:            46968 kB
Committed_AS:    71612 kB
PageTables:        928 kB
VmallocTotal:  3612664 kB
VmallocUsed:      1516 kB
VmallocChunk:  3610876 kB
HugePages_Total:     0
HugePages_Free:      0
Hugepagesize:     4096 kB
发表于 2004-11-12 12:17:37 | 显示全部楼层
我的meminfo里的内容没有你那么多,只到SwapFree这行为止。
$man proc
查找meminfo
/meminfo
还有free的内容(下面是我机器上的执行结果)
$man free
[dehao@fedora doc]$ rpm -qf /usr/bin/free
procps-2.0.17-5
$cd /usr/share/doc/procps-2.0.17-5/
好象没什么东西可以看

在redhat主站上找到了
[php]
Tips & Tricks
Featured Article: /proc/meminfo Explained
March 2003

"Free," "buffer," "swap," "dirty." What does it all mean? If you said, "something to do with the Summer of '68", you may need a primer on 'meminfo'.

The entries in the /proc/meminfo can help explain what's going on with your memory usage, if you know how to read it.

Example of "cat /proc/meminfo":

root:        total:            used:            free:                  shared:        buffers:        cached:
Mem:          1055760384        1041887232        13873152        0        100417536         711233536
Swap:         1077501952          8540160         1068961792
                                               

MemTotal:                1031016 kB       
MemFree:                13548 kB
MemShared:                0 kB
Buffers:                98064 kB
Cached:                        692320 kB
SwapCached:                2244 kB
Active:                        563112 kB
Inact_dirty:                309584 kB
Inact_clean:                79508 kB
Inact_target:                190440 kB
HighTotal:                130992 kB
HighFree:                1876 kB
LowTotal:                900024 kB
LowFree:                11672 kB
SwapTotal:                1052248 kB
SwapFree:                1043908 kB
Committed_AS:                332340 kB
                                               

The information comes in the form of both high-level and low-level statistics. At the top you see a quick summary of the most common values people would like to look at. Below you find the individual values we will discuss. First we will discuss the high-level statistics.
High-Level Statistics

    * MemTotal: Total usable ram (i.e. physical ram minus a few reserved bits and the kernel binary code)
    * MemFree: Is sum of LowFree+HighFree (overall stat)
    * MemShared: 0; is here for compat reasons but always zero.
    * Buffers: Memory in buffer cache. mostly useless as metric nowadays
    * Cached: Memory in the pagecache (diskcache) minus SwapCache
    * SwapCache: Memory that once was swapped out, is swapped back in but still also is in the swapfile (if memory is needed it doesn't need to be swapped out AGAIN because it is already in the swapfile. This saves I/O)

Detailed Level Statistics
VM Statistics

VM splits the cache pages into "active" and "inactive" memory. The idea is that if you need memory and some cache needs to be sacrificed for that, you take it from inactive since that's expected to be not used. The vm checks what is used on a regular basis and moves stuff around.

When you use memory, the CPU sets a bit in the pagetable and the VM checks that bit occasionally, and based on that, it can move pages back to active. And within active there's an order of "longest ago not used" (roughly, it's a little more complex in reality). The longest-ago used ones can get moved to inactive. Inactive is split into two in the above kernel (2.4.18-24.8.0). Some have it three.

    * Active: Memory that has been used more recently and usually not reclaimed unless absolutely necessary.
    * Inact_dirty: Dirty means "might need writing to disk or swap." Takes more work to free. Examples might be files that have not been written to yet. They aren't written to memory too soon in order to keep the I/O down. For instance, if you're writing logs, it might be better to wait until you have a complete log ready before sending it to disk.
    * Inact_clean: Assumed to be easily freeable. The kernel will try to keep some clean stuff around always to have a bit of breathing room.
    * Inact_target: Just a goal metric the kernel uses for making sure there are enough inactive pages around. When exceeded, the kernel will not do work to move pages from active to inactive. A page can also get inactive in a few other ways, e.g. if you do a long sequential I/O, the kernel assumes you're not going to use that memory and makes it inactive preventively. So you can get more inactive pages than the target because the kernel marks some cache as "more likely to be never used" and lets it cheat in the "last used" order.

Memory Statistics

    * HighTotal: is the total amount of memory in the high region. Highmem is all memory above (approx) 860MB of physical RAM. Kernel uses indirect tricks to access the high memory region. Data cache can go in this memory region.
    * LowTotal: The total amount of non-highmem memory.
    * LowFree: The amount of free memory of the low memory region. This is the memory the kernel can address directly. All kernel datastructures need to go into low memory.
    * SwapTotal: Total amount of physical swap memory.
    * SwapFree: Total amount of swap memory free.
    * Committed_AS: An estimate of how much RAM you would need to make a 99.99% guarantee that there never is OOM (out of memory) for this workload. Normally the kernel will overcommit memory. That means, say you do a 1GB malloc, nothing happens, really. Only when you start USING that malloc memory you will get real memory on demand, and just as much as you use. So you sort of take a mortgage and hope the bank doesn't go bust. Other cases might include when you mmap a file that's shared only when you write to it and you get a private copy of that data. While it normally is shared between processes. The Committed_AS is a guesstimate of how much RAM/swap you would need worst-case.

Copyright © 2004 Red Hat, Inc. All rights reserved.
Privacy Policy : Terms of Use : Patent promise : Company : Contact
Log in to Your Account
[/php]
发表于 2004-11-12 14:50:52 | 显示全部楼层
哈哈 得宝了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表