Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linux 2.6 and virtual memory management.... question!

Status
Not open for further replies.

exsnafu

Technical User
Apr 25, 2008
99
0
0
US
ok, i've recently started getting more involved with the linux side of the house and am finding that the linux VMM is not as well documented as some other OS's.. or maybe it is and I just haven't found a single solid source of information.. instead, i've found many different articles by many different people and a few seem to contradict eachother.

... anyways, can someone help me understand a few things here and/or correct my misconceptions.

first, assumption is that we're working with a RHEL4/RHEL5 server and nobody has been mucking with sysctl... and we're not virtualized.

so I have a typical question, application owner sees that his free list as reported by free/vmstat is dangerously low(to him) and i try to explain that typically linux and unix in general always like to make maximum use of memory and when not in use by applications the excess will be taken up by file caching/buffers to help speed up expensive IO operations, you're not paging out anything and basically nothing to worry about... ok, now to prove it.

in /proc/meminfo I see 6 values that peek my interest
MemTotal: 16384576 kB (16GB)
MemFree: 960332 kB (960MB)
Buffers: 376524 kB (370MB)
Cached: 14149840 kB (14GB)
Active: 10796856 kB (10GB)
Inactive: 4026432 kB (4GB)


memfree - pretty simple.
buffers - i assume this to be file caching, yes?
cached - this is where i get a little confused, what is cached? in this example its taking up most of my real memory and is the sum of active and inactive more or less.. is this coincidence?

active memory seems pretty straightforward, inactive by itself seems pretty straightforward but is there a link between inactive and cached? are inactive pages left out there indefinitely until either the kernel needs to allocate more pages for a process and they get flushed or a soft page fault flips the bit and brings them back to active?

in this example FYI, the system is not experiencing anything that indicates there is a memory bottleneck, no paging to swap space.. sar doesn't show any hard faults occuring etc etc... i'm just trying to accurately describe what the memory is being used for.

any good recommendations on solid documentation around kernel 2.6 VMM?
 
Unless you really need to dig, the output of the free command is usually sufficient to see the state of memory on your system.

Code:
$ free
             total       used       free     shared    buffers     cached
Mem:      12297096   12214784      82312          0     163960    1322088
-/+ buffers/cache:   10728736    1568360
Swap:     16779852     719200   16060652

Typically I would look at the second line of output, which considers "buffers" and "cached" to be part of the "free" memory, because if an application needed that memory it would be released anyway.

"buffers" is where filesystem metadata is cached, "cached" is where data from the actual files is cached.

For documentation I would usually look at /usr/share/doc/kernel-doc-2.6.9/Documentation/filesystems/proc.txt or the equivalent on your system, as you would hope it would be kept up to date with the kernel that is installed. I don't know what active/inactive are, but it says:

proc.txt said:
Active: Memory that has been used more recently and usually not
reclaimed unless absolutely necessary.
Inactive: Memory which has been less recently used. It is more
eligible to be reclaimed for other purposes

So I'd guess that in your case they are mostly referring to the contents of "cached", since they add up to about that amount... but that is not always the case.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top