2007-09-21 10:00:55

by Michal Kazior

[permalink] [raw]
Subject: [BUG] Possible cache memory leak.

Hi,

I've discovered a strange thing lately. My memory is being sucked out
when doing (I suppose) _a lot_ of stat() on the file system. I got left
once with ~30MB of ram (of 512 in total) which made my system trash
like hell. You might try doing the following to reproduce the effect:

$ echo 1 > /proc/sys/vm/drop_caches
$ vmstat # write down the result
$ du -s -x /lots/of/files # keep it running for a minute
$ echo 1 > /proc/sys/vm/drop_caches
$ vmstat # write it down too

The latter vmstat should report less memory then the previous one.
(sum up free+buff+cache) Is this an expected behaviour ? If yes,
please explain.

The memory can be magically freed by umount-ing the partition that was
scanned or by deleting the files that were stat()-ed. However, one
cannot simply umount "/".

Note: Make sure you point 'du' to a place where you have dozens of
files, so it can keep it running for a minute or more.

I can confirm that to be an issue to 2.6.23-rc6 and 2.6.23-rc7.
A friend of mine reports that 2.6.22.5 produces same results.
Tested on jfs and ext3.


Regards,
MichaƂ Kazior.


PS. I'm not subscribed to the list, so CC me please.


2007-09-21 14:48:15

by Bodo Eggert

[permalink] [raw]
Subject: Re: [BUG] Possible cache memory leak.

Micha? Kazior <[email protected]> wrote:

> I've discovered a strange thing lately. My memory is being sucked out
> when doing (I suppose) _a lot_ of stat() on the file system. I got left
> once with ~30MB of ram (of 512 in total) which made my system trash
> like hell. You might try doing the following to reproduce the effect:
>
> $ echo 1 > /proc/sys/vm/drop_caches
> $ vmstat # write down the result
> $ du -s -x /lots/of/files # keep it running for a minute
> $ echo 1 > /proc/sys/vm/drop_caches
> $ vmstat # write it down too

RTFM: Documentation/filesystems/proc.txt
--
To define recursion, we must first define recursion.

Fri?, Spammer: [email protected] [email protected]
[email protected] [email protected]