mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: David Ashley <dash@xdr.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Cache memory never gets released
Date: Fri, 25 Jun 2004 10:44:32 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.53.0406251034320.28537@chaos> (raw)
In-Reply-To: <200406251424.i5PEO9UX000396@xdr.com>

On Fri, 25 Jun 2004, David Ashley wrote:

> Marcelo Tosatti wrote:
> >Cached memory can be easily reclaimed, take a look at /proc/meminfo "Inactive"
> >list.
>
> Here is /proc/meminfo from a box that has all but exhausted its free memory:
>         total:    used:    free:  shared: buffers:  cached:
> Mem:  122064896 84348928 37715968        0   634880 74829824
> Swap:        0        0        0
> MemTotal:       119204 kB
> MemFree:         36832 kB
> MemShared:           0 kB
> Buffers:           620 kB
> Cached:          73076 kB
> SwapCached:          0 kB
> Active:          70380 kB
> Inactive:         7324 kB
> HighTotal:           0 kB
> HighFree:            0 kB
> LowTotal:       119204 kB
> LowFree:         36832 kB
> SwapTotal:           0 kB
> SwapFree:            0 kB
>
> >Add more swap.
>
> Might as well suggest walking on water. The hardware is set in stone, this is
> a software issue :^).
>
> Something is preventing the cached memory to get reused, it's like it's gone
> for good.
>
> Is there any count of how often a cached block is accessed? If there is such
> a count, and the count has an effect on whether to allow the release of the
> cached block, that could explain this behaviour. Because it could turn out
> that the cached blocks are accessed thousands of times.
>
> Thanks--
> Dave

Are you sure you have a problem? If you do `ls -R /` on a file-system
and then look at the cached RAM, you see a lot. It's the dircache.
It is some of the first to be used when the system needs RAM. If you
compile the kernel with `make -j 20 bzImage` so you have a lot of
tasks, needing lots of RAM, the cached value goes way down. It
will eventually be "free" after the compile completes.

Basically, the only way to return cached RAM to the free-list
is to run programs requiring RAM. What is listed as "cached" really
means "RAM that was used, but wasn't freed because we don't need
it yet.... Freeing RAM is as expensive as acquiring it so if it's
used by a kernel buffer, it isn't freed until it's needed.

This is linux-2.4.26. If you are using an exprimental kernel,
memory-allocation might be broken but is probably not.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
            Note 96.31% of all statistics are fiction.



  reply	other threads:[~2004-06-25 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-25 14:24 David Ashley
2004-06-25 14:44 ` Richard B. Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-06-25 15:47 David Ashley
2004-06-25  0:31 David Ashley
2004-06-25 12:34 ` Marcelo Tosatti

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=Pine.LNX.4.53.0406251034320.28537@chaos \
    --to=root@chaos.analogic.com \
    --cc=dash@xdr.com \
    --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

all inboxes | Powered by JetHome®