Date: Tue, 16 Oct 2007 19:04:06 +1000 From: Peter Jeremy <peterjeremy@optushome.com.au> To: Artem Kuchin <matrix@itlegion.ru> Cc: freebsd-stable@freebsd.org Subject: Re: Question about 'top' values on memory usage Message-ID: <20071016090406.GL1184@turion.vk2pj.dyndns.org> In-Reply-To: <20071014203420.GB2490@dan.emsphone.com> References: <008801c80e66$7be49490$0c00a8c0@Artem> <20071014203420.GB2490@dan.emsphone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--qjNfmADvan18RZcF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In the last episode (Oct 14), Artem Kuchin said: > Maybe someone with deeper knowledge of the internals of FreeBSD can > clean up something for me (any for many others)^ >=20 > Here are lines from my top: >=20 > PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND > 9258 hordelo_ru 1 4 0 40992K 4260K accept 0 0:00 0.00% httpd > 9257 hordelo_ru 1 44 0 40992K 4296K select 1 0:00 0.00% httpd > 9259 hordelo_ru 1 4 0 40992K 4292K select 1 0:00 0.00% httpd >=20 > As you see, 'size' is the same for all processes, while RES varies. >=20 > As i understand, the real memory taken by a process is RES and SIZE > include a bunch of shares .so libs, so, if more httpd's started each > will take only about 4300K more, so, 100 https will take 430000K to > run, right? Determining the amount of shared vs unshared memory for each process is not totally trivial. All I can suggest is using procfs and reading /proc/<<PID>>/map eg: turion% dd if=3D/proc/curproc/map bs=3D256k 0x400000 0x402000 2 0 0xffffff002e4710e0 r-x 1 0 0x0 COW NC vnode /bin/dd 0x502000 0x503000 1 0 0xffffff001c41cd20 rw- 2 0 0x2180 NCOW NNC default - 0x503000 0x505000 2 0 0xffffff001c41cd20 rwx 2 0 0x2180 NCOW NNC default - and so on The columns are: start address, end address, resident pages, private resident pages, vm_object_t address, protection, reference count, shadow count, flags, cow, copy-needed, type, path See <vm/vm_object.h> for flags This will let you indentify shared vs private space as well as whether it's file or swap backed. --=20 Peter Jeremy --qjNfmADvan18RZcF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFHFH6G/opHv/APuIcRAon1AJ4gceMqNrqaWi8o3BpoXaWB9pvAvgCfbe9b QnxXx1y2iNiT5UUudZBXsnc= =XXpU -----END PGP SIGNATURE----- --qjNfmADvan18RZcF--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071016090406.GL1184>