lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <FA6FB5FA4DA6BF4386D129273B2E3EC3024B847E@xmb-sjc-214.amer.cisco.com> Date: Sun, 21 Oct 2007 23:28:37 -0700 From: "Ravinandan Arakali (rarakali)" <rarakali@...co.com> To: "Vaidyanathan Srinivasan" <svaidy@...ux.vnet.ibm.com> Cc: "Linux Kernel" <linux-kernel@...r.kernel.org> Subject: RE: Question about free/used memory on Linux Hi Vaidy, I will use the metric you have suggested. Thanks, Ravi -----Original Message----- From: Vaidyanathan Srinivasan [mailto:svaidy@...ux.vnet.ibm.com] Sent: Sunday, October 21, 2007 10:50 PM To: Ravinandan Arakali (rarakali) Cc: Linux Kernel Subject: Re: Question about free/used memory on Linux Ravinandan Arakali (rarakali) wrote: > Hi Vaidy, > Thanks for clarifying several of my doubts. > > To answer your question about my intention, we currently have a system > with 2 GB RAM and I need to find out the actual used and free memory > so that we can decide if the same setup(applications, tmpfs etc.) can > run on another system with lesser memory. > > Is it correct to say that the "used" field "free -m" excluding > buffers/caches would give the correct idea of used memory (I mean does > it take care of shared memory, shared copies of libraries etc.) ? I > assume it does not include /dev/shm usage since that's also a tmpfs > partition ? Thats correct. The used excluding the buffer caches gives most of the memory used by the system. You have excludes _all_ file backed memory including shm. > > If so, then I can add the memory used by tmpfs partitions to the above > and get the total memory used ? > > For eg. if my "free -m" appears as below: > Linux(debug)# free -m > total used free shared buffers > cached > Mem: 2014 984 1030 0 80 > 594 > -/+ buffers/cache: 309 1705 > > Can I say that 309MB + 350 MB(size of tmpfs partitions including > /dev/shm) > is the used memory on my system ? Two problems with this logic: 1. all of tmpfs may not be really used. You are over committing. 2. You still miss the pages needed to map the program code. They are file backed too. Though this will be very less amount of memory compared to data and shared memory. Let me suggest a metric: 1. Take the used part excluding the buffers (309MB) in your case and add 'Mapped' and 'Dirty' from /proc/meminfo This may be better than adding tmpfs/shmdev size. 2. Once your system is running will all applications loaded, cleanup the pagecache (file data cached in memory) sync echo 1 > /proc/sys/vm/drop_caches The first sync will bring down 'Dirty' count and drop_caches will reclaim all 'not needed' file cache memory. Now if you use 'free' and take the used count _with_ the buffers and file cache, this will provide a realistic value. (Actually Free in /proc/meminfo) Do not exclude buffers they are _needed_ for optimum system operation. With the above figure you can probably add 10% or more memory as extra memory for file cache when the system is operating with full load. If you want to be sure of these experiments boot you system with less memory using mem=xxx kernel parameter and run some performance tests to ensure the degradation is under acceptable limits. --Vaidy - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists