mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: John Weber <weber@nyc.rr.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Disappearing RAM
Date: Mon, 23 Apr 2001 18:23:28 +0200	[thread overview]
Message-ID: <20010423182328.A16338@gruyere.muc.suse.de> (raw)
In-Reply-To: <3AE4512D.9030602@nyc.rr.com>
In-Reply-To: <3AE4512D.9030602@nyc.rr.com>; from weber@nyc.rr.com on Mon, Apr 23, 2001 at 11:58:37AM -0400

On Mon, Apr 23, 2001 at 11:58:37AM -0400, John Weber wrote:
> 
> There appears to be quite a difference between the memory usage reported
> by top
> (immediately after boot and minus all user processes) and that reported
> by the kernel
> during boot.  Can anyone give me any hints as to why this might happen?
> 
> I am assuming that if I subtract all the memory in use by processes
> listed by top from all
> the memory in use that this equals the amount of memory used by the
> kernel.
> These numbers do not add up.

The view given by top is inaccurate because it has no way to detect shared
pages properly. This means for example that when you have glibc mapped into
all your N processes it counted N times its size, even though it only exists
once in memory. Worse it gets when you work with threaded programs; they
share their memory completely, but top/ps has no way to detect this and 
counts the single shared process space for every process (I have an 
experimental patch to fix the later problem) 

In addition there are quite a bit of internal data structures in the kernel
which never appear in top, but eat memory. Most prominent of that is the
page table itself, which eats a few percent of your ram for a management
structure for every page (in 2.2 on 32bit ~40 bytes every 4K of memory;
in 2.4 it is much worse) 

> A related question:  In the 2.2 kernels, does the kernel pre-allocate
> any amount of memory
> for modules?

No.



-Andi

  reply	other threads:[~2001-04-23 16:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-23 15:58 John Weber
2001-04-23 16:23 ` Andi Kleen [this message]
2001-04-23 17:20 ` Richard B. Johnson

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=20010423182328.A16338@gruyere.muc.suse.de \
    --to=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=weber@nyc.rr.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

all inboxes | Powered by JetHome®