From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
To: "Ravinandan Arakali (rarakali)" <rarakali@cisco.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Question about free/used memory on Linux
Date: Mon, 22 Oct 2007 00:30:33 +0530 [thread overview]
Message-ID: <471BA1D1.5040905@linux.vnet.ibm.com> (raw)
In-Reply-To: <FA6FB5FA4DA6BF4386D129273B2E3EC3024B847B@xmb-sjc-214.amer.cisco.com>
Ravinandan Arakali (rarakali) wrote:
> Hi kernel gurus,
> I am trying to find out the memory that's used on my linux box.
> I find that there are quite a few confusing metrics. How do
> I find out the "true" used memory ?
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.
>
> 1. For eg. "free -m" shows free memory (excluding buffers/caches)
> as 308 MB while I can see(from "df" output) that the the tmpfs
> partitions take up about 400 MB. So, does "free -m" not consider
> the tmpfs partitions ?
Pages used from tmpfs should come under Mapped or Cached. They are not
counted as free.
> 2. I try to add up RSS field of all processes reported by
> "ps aux" command. But is it true that this would be misleading
> in that, shared memory used by, say 2 processes would show
> up twice here although there's only one copy in memory. Also
> does this consider the fact that there's only one copy
> of shared libraries ?
>
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.
> 3. I guess "free -m" and "top" commands use /proc/meminfo
> and hence all these outputs are same ?
Yes, all of them parse /proc/meminfo
--Vaidy
next prev parent reply other threads:[~2007-10-21 18:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-21 17:54 Question about free/used memory on Linux Ravinandan Arakali (rarakali)
2007-10-21 19:00 ` Vaidyanathan Srinivasan [this message]
2007-10-21 20:21 ` Ravinandan Arakali (rarakali)
2007-10-22 5:50 ` Vaidyanathan Srinivasan
2007-10-22 6:28 ` Ravinandan Arakali (rarakali)
2007-11-14 6:14 ` Ravinandan Arakali (rarakali)
2007-11-14 11:58 ` Pádraig Brady
2007-11-14 18:18 ` Ravinandan Arakali (rarakali)
2007-10-22 11:51 ` Helge Hafting
2007-10-22 17:34 ` linux-os (Dick Johnson)
2007-10-22 10:05 ` Pádraig Brady
2007-10-23 1:58 ` Ravinandan Arakali (rarakali)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=471BA1D1.5040905@linux.vnet.ibm.com \
--to=svaidy@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rarakali@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox