public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Doug McNaught <doug@mcnaught.org>
To: bluefoxicy@linux.net
Cc: linux-kernel@vger.kernel.org
Subject: Re: Slab allocator . . . cache?  WTF is it?
Date: Tue, 30 Dec 2003 18:04:54 -0500	[thread overview]
Message-ID: <87znd9lxex.fsf@asmodeus.mcnaught.org> (raw)
In-Reply-To: <20031230221859.15F503956@sitemail.everyone.net> (john moser's message of "Tue, 30 Dec 2003 14:18:58 -0800 (PST)")

john moser <bluefoxicy@linux.net> writes:

> I'm wondering, what IS cache?  It seems to increase even when swap
> is not used, and sometimes when there's no swap partition enabled.
> It also seems to cause me to run into swap when I have ample ram
> available, assuming that cache is just some sort of cache that is
> copied from and mirrors another portion of ram for some sort of
> speed increase.  It's wasteful to me, and I want to more understand
> its implimentation and its purpose, and in all honesty limit its
> impact if possible.

Short answer: cache is the use of memory to store what would otherwise
have to be read from disk, like parts of frequently used files etc.
Linux will trade off cache against other RAM needs like program memory
on an ongoing basis, and (almost always) does a really good job of it.

Don't be alarmed about going into swap somewhat in normal
operation--Linux is storing less important data on the disk to make
more room in RAM for "hot" data.  Obviously, if you have hundreds of
megs in swap or it grows quickly, you may need to look at it.

> I got this RAM upgrade because I was using about 676M of RAM total,
> including swap, at peak; and now I find myself using 820M RAM at
> peak and about 750-800 continually.

That means the kernel is doing exactly what it's supposed to do.  If
memory isn't needed by programs and isn't used for cache, it just goes
to waste, so Linux tries to use it for one or the other.  :)

-Doug

  parent reply	other threads:[~2003-12-30 23:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-30 22:18 Slab allocator . . . cache? WTF is it? john moser
2003-12-30 23:01 ` Fox!MURDER
2003-12-30 23:04 ` Doug McNaught [this message]
2003-12-30 23:20 ` David Schwartz
2003-12-30 23:50 ` Mike Fedyk
2003-12-31  3:27   ` Mike Fedyk

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=87znd9lxex.fsf@asmodeus.mcnaught.org \
    --to=doug@mcnaught.org \
    --cc=bluefoxicy@linux.net \
    --cc=linux-kernel@vger.kernel.org \
    /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