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 ?
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 ?
Thanks,
Ravi
-----Original Message-----
From: Vaidyanathan Srinivasan [mailto:svaidy@linux.vnet.ibm.com]
Sent: Sunday, October 21, 2007 12:01 PM
To: Ravinandan Arakali (rarakali)
Cc: Linux Kernel
Subject: Re: Question about free/used memory on Linux
Ravinandan Arakali (rarakali) wrote:
pagecache pages may be the reason for the confusion. Most free memory
can be consumed under 'Cached' in /proc/meminfo
Most of this memory is easily reclaimable and can be considered 'free'.
However the cost of reclaim increases if the pages are memory mapped
and/or dirty.
Cached-Mapped-Dirty in /proc/meminfo can be seen as a easily freeable
memory and can be added to the 'Free' in /proc/meminfo count
What is your intention of finding free memory in the system? Linux
kernel takes the best decision of using available RAM for file cache or
applications code/data as and when needed. Ideally the 'Free' count
will be a very low value on a heavily used system. If application
needs more memory, then the kernel will shrink the caches and give the
reclaimed memory to the application.
Pages used from tmpfs should come under Mapped or Cached. They are not
counted as free.
RSS is from each process point of view. If the page is present in RAM,
it is counted. If the pages is shared, then it is counted in both
process address space.
Yes, all of them parse /proc/meminfo
--Vaidy
-
| James Bottomley | [Ksummit-2008-discuss] Fixing the Kernel Janitors project |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| James Bottomley | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| David Miller | [GIT]: Networking |
| Antonio Almeida | HTB accuracy for high speed |
