From: Andrew Morton <akpm@digeo.com>
To: dementiev@mpi-sb.mpg.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: buffer leakage in kernel?
Date: Mon, 27 Jan 2003 12:51:38 -0800 [thread overview]
Message-ID: <20030127125138.5dc35b1d.akpm@digeo.com> (raw)
In-Reply-To: <3E3564EB.8E675E@mpi-sb.mpg.de>
Roman Dementiev <dementiev@mpi-sb.mpg.de> wrote:
>
> Application allocates 512 MB and never uses more.
> 2MB buffers are used for each read() and write() calls.
> Each file has only one read or write request going any time. There is no othr
> memory-
> hungry applications running.
OK.
> > Please perform this test:
> >
> > 1: Wait until you have 500M "Buffers"
> > 2: cat 64_gig_file > /dev/null
> > 3: Now see how large "Buffers" is. It should have reduced a lot.
>
> Yes, it worked, they had reduced.
> Does this mean, that cached indirect buffers can't be kicked out of memory
> automatically
> and ONLY non-O_DIRECT access can do it? I suppose, they should be displaced by
> newly allocated indirect buffers and user memory allocation.
I suspect what is happening is that you've managed to find a code path in
which the kernel is allocating lots of memory in a mode in which it cannot
run effective page reclaim. This would be more likely to be true if you only
see the failures when writing.
It would help if you could change mm/vmscan.c:try_to_free_pages_zone()
thusly:
/*
* Hmm.. Cache shrink failed - time to kill something?
* Mhwahahhaha! This is the part I really like. Giggle.
*/
+ show_stack(0);
out_of_memory();
return 0;
}
and pass the resulting log output through ksyoops.
And here's a protopatch to teach the kernel to make sure that there's a
decent amount of free memory before it goes and performs GFP_NOFS pagecache
allocations:
diff -puN fs/buffer.c~a fs/buffer.c
--- 24/fs/buffer.c~a 2003-01-27 12:28:02.000000000 -0800
+++ 24-akpm/fs/buffer.c 2003-01-27 12:28:23.000000000 -0800
@@ -2112,6 +2112,8 @@ int generic_direct_IO(int rw, struct ino
for (i = 0; i < nr_blocks; i++, blocknr++) {
struct buffer_head bh;
+ try_to_free_pages(GFP_KERNEL);
+
bh.b_state = 0;
bh.b_dev = inode->i_dev;
bh.b_size = blocksize;
If that sheds no light, please send me the app and I'll see if I can
reproduce it. Thanks.
next prev parent reply other threads:[~2003-01-27 20:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-24 12:49 Roman Dementiev
2003-01-24 18:07 ` Andreas Dilger
2003-01-24 21:02 ` Andrew Morton
2003-01-27 16:57 ` Roman Dementiev
2003-01-27 20:51 ` Andrew Morton [this message]
2003-02-04 12:58 ` Roman Dementiev
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=20030127125138.5dc35b1d.akpm@digeo.com \
--to=akpm@digeo.com \
--cc=dementiev@mpi-sb.mpg.de \
--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
Powered by JetHome