{"id":62,"date":"2007-04-11T09:33:52","date_gmt":"2007-04-11T17:33:52","guid":{"rendered":"http:\/\/jim-zimmerman.com\/blog\/?p=62"},"modified":"2007-05-20T05:56:10","modified_gmt":"2007-05-20T13:56:10","slug":"procmeminfo-document","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=62","title":{"rendered":"\/proc\/meminfo document"},"content":{"rendered":"<p>cat \/proc\/meminfo<br \/>\nMemTotal:      2075540 kB<br \/>\nMemFree:        210148 kB<br \/>\nBuffers:        653848 kB<br \/>\nCached:         827688 kB<br \/>\nSwapCached:          0 kB<br \/>\nActive:        1074788 kB<br \/>\nInactive:       610512 kB<br \/>\nHighTotal:     1179088 kB<br \/>\nHighFree:       200644 kB<br \/>\nLowTotal:       896452 kB<br \/>\nLowFree:          9504 kB<br \/>\nSwapTotal:     2096472 kB<br \/>\nSwapFree:      2096280 kB<br \/>\nDirty:             104 kB<br \/>\nWriteback:           0 kB<br \/>\nAnonPages:      203784 kB<br \/>\nMapped:          60056 kB<br \/>\nSlab:           164348 kB<br \/>\nSReclaimable:   147348 kB<br \/>\nSUnreclaim:      17000 kB<br \/>\nPageTables:       5352 kB<br \/>\nNFS_Unstable:        0 kB<br \/>\nBounce:              0 kB<br \/>\nCommitLimit:   3134240 kB<br \/>\nCommitted_AS:   679184 kB<br \/>\nVmallocTotal:   114680 kB<br \/>\nVmallocUsed:      4188 kB<br \/>\nVmallocChunk:   110128 kB<br \/>\nHugePages_Total:     0<br \/>\nHugePages_Free:      0<br \/>\nHugePages_Rsvd:      0<br \/>\nHugepagesize:     4096 kB<\/p>\n<p><a href=\"http:\/\/kbase.redhat.com\/faq\/FAQ_80_4539.shtm\">Source for the information below.<\/a><\/p>\n<p>Below you find the individual values we will discuss. First we will discuss the high-level statistics.<br \/>\nHigh-Level Statistics<\/p>\n<p>    * MemTotal: Total usable ram (i.e. physical ram minus a few reserved bits and the kernel binary code)<br \/>\n    * MemFree: Is sum of LowFree+HighFree (overall stat)<br \/>\n    * MemShared: 0; is here for compat reasons but always zero.<br \/>\n    * Buffers: Memory in buffer cache, mostly useless as metric nowadays<br \/>\n    * Cached: Memory in the pagecache (diskcache) minus SwapCache<br \/>\n    * SwapCache: Memory that once was swapped out, is swapped back in, but is still in the swapfile. (If memory is needed it does not need to be swapped out AGAIN because it is already in the swapfile. This saves I\/O.)<\/p>\n<p>Detailed Level Statistics &#8211; VM Statistics<\/p>\n<p>VM splits the cache pages into &#8220;active&#8221; and &#8220;inactive&#8221; 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 is expected to be not used. The VM checks what is used on a regular basis and moves stuff around.<\/p>\n<p>When you use memory, the CPU sets a bit in the pagetable and the VM checks that bit occasionally. Based on that, it can move pages back to active. Within active, there is an order of &#8220;longest ago not used&#8221; (roughly &#8211; it is 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.<\/p>\n<p>    * Active: Memory that has been used more recently and usually not reclaimed unless absolutely necessary.<br \/>\n    * Inact_dirty: Dirty means &#8220;might need writing to disk or swap.&#8221; Takes more work to free. Examples might be files that have not been written to yet. They are not written to memory too soon in order to keep the I\/O down. For instance, if you are writing logs, it might be better to wait until you have a complete log ready before sending it to disk.<br \/>\n    * 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.<br \/>\n    * 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 are 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 &#8220;more likely to be never used&#8221; and lets it cheat in the &#8220;last used&#8221; order.<\/p>\n<p>Memory Statistics<\/p>\n<p>    * 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.<br \/>\n    * LowTotal: The total amount of non-highmem memory.<br \/>\n    * 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.<br \/>\n    * SwapTotal: Total amount of physical swap memory.<br \/>\n    * SwapFree: Total amount of swap memory free.<br \/>\n    * 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 does not go bust. Other cases might include when you mmap a file that is 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>cat \/proc\/meminfo MemTotal: 2075540 kB MemFree: 210148 kB Buffers: 653848 kB Cached: 827688 kB SwapCached: 0 kB Active: 1074788 kB Inactive: 610512 kB HighTotal: 1179088 kB HighFree: 200644 kB LowTotal: 896452 kB LowFree: 9504 kB SwapTotal: 2096472 kB SwapFree: 2096280 kB Dirty: 104 kB Writeback: 0 kB AnonPages: 203784 kB Mapped: 60056 kB Slab: 164348 [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-documentation"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=62"}],"version-history":[{"count":0,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}