This is somewhat empirical, and depending on the usage of shared libraries
will over-estimate the situation somewhat.
Not a bad thing in the context.
Determining actual accountable memory on linux has been like catching a
greased pig. With recent kernels you can work back from the pagemaps - here's
a citation from ../Documentation in the kernel source tree.
<quote>
Using pagemap to do something useful:
The general procedure for using pagemap to find out about a process' memory
usage goes like this:
1. Read /proc/pid/maps to determine which parts of the memory space are
mapped to what.
2. Select the maps you are interested in -- all of them, or a particular
library, or the stack or the heap, etc.
3. Open /proc/pid/pagemap and seek to the pages you would like to examine.
4. Read a u64 for each page from pagemap.
5. Open /proc/kpagecount and/or /proc/kpageflags. For each PFN you just
read, seek to that entry in the file, and read the data you want.
For example, to find the "unique set size" (USS), which is the amount of
memory that a process is using that is not shared with any other process,
you can go through every map in the process, find the PFNs, look those up
in kpagecount, and tally up the number of pages that are only referenced
once.
</quote>
I have seen some user-space code to do all this - must move the testing of
this up my "to-do" list.
Shane ...
On Sat, Jul 24th, 2010 at 4:45 AM, "Mrohs, Ray" <[email protected]> wrote:
> Start up all your Linux procs and then run this little script.
>
> #! /bin/sh
> ps -eo pmem | awk '{pmem += $1}; END {print "pmem = "pmem"%"}';
>
> It will give you a ballpark percentage of current memory utilization.
> I tuned some Apache/ftp servers down to 100M with no ill effects.
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/