On Tue, May 02, 2006 at 10:00:20AM +0200, Torsten Foertsch wrote: > For 2.4 kernel series the figures got from /proc/PID/statm are as valid as > the > figures from Linux::Smaps for kernels 2.6.14 and higher. For 2.6.0 up to > 2.6.13 there is no way to count COW (shared by copy-on-write) pages. Since > COW is the main way of sharing memory in a mod_perl environment figures that > don't take these pages into account are useless.
Ok, I'm running 2.6.15 with 1GB. I tried looking over the kernel source, but didn't get too far. I realize I can't total up shared_* memory and have it mean anything (since I don't really know which other processes it is shared with), but can I total up private data and get an idea of the minimum required virtual memory? This prints out the values and totals them up at the end, which is not very meaningful, but I'm curious about the private_* values: $ perl smaps.pl `pidof apache2` (5 pids) [...] [9677] size: 62028K rss: 43140K shared_clean: 4388K shared_dirty: 18500K private_clean: 0K private_dirty: 20252K [9675] size: 56360K rss: 38164K shared_clean: 4472K shared_dirty: 21144K private_clean: 0K private_dirty: 12548K [totals] size: 299780K rss: 206820K shared_clean: 20860K shared_dirty: 97476K private_clean: 0K private_dirty: 88484K Compare that to MySQL, which is statically linked on this machine: $ perl smaps.pl `pidof mysqld--kernis` (21 pids) [...] [9265] size: 145668K rss: 36576K shared_clean: 4040K shared_dirty: 0K private_clean: 0K private_dirty: 32536K [9264] size: 145668K rss: 36576K shared_clean: 4040K shared_dirty: 0K private_clean: 0K private_dirty: 32536K [totals] size: 3059028K rss: 768096K shared_clean: 84840K shared_dirty: 0K private_clean: 0K private_dirty: 683256K Looks like I don't want all those MySQL processes swapped in at the same time. Compare that with postgres on the same machine: $ perl smaps.pl 28321 28322 28323 9681 9682 9683 9684 [...] [9683] size: 21248K rss: 15164K shared_clean: 2992K shared_dirty: 8348K private_clean: 0K private_dirty: 3824K [9684] size: 21736K rss: 15740K shared_clean: 3780K shared_dirty: 7732K private_clean: 0K private_dirty: 4228K [totals] size: 116744K rss: 68432K shared_clean: 19708K shared_dirty: 33912K private_clean: 0K private_dirty: 14812K -- Bill Moseley [EMAIL PROTECTED]