From: Benjamin Rutt <rutt.4+news@osu.edu>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>
Subject: Re: clearing filesystem cache for I/O benchmarks
Date: Tue, 27 Jul 2004 13:25:17 -0400 [thread overview]
Message-ID: <871xixpdky.fsf@osu.edu> (raw)
In-Reply-To: <20040726234005.597a94db.akpm@osdl.org>
Andrew Morton <akpm@osdl.org> writes:
> (Please don't remove people from the email recipient list when doing kernel
> work.)
Sorry, I'm reading via gmane and my newsreader doesn't make it
straightforward to do so. But I'll do it manually for you.
> However... If you write any amount of data to a file with O_DIRECT, that
> will, as a side-effect, remove _all_ of that file's pagecache. In 2.4 as
> well as 2.6. So you could scrub the pagecache by reading the first 4k then
> writing it back with O_DIRECT.
Thanks, that does work for ext3, very well. It's obvious that it
clears kernel page cache and not controller/disk cache.
>> A related question...if no posix_fadvise() advice has been given, does
>> reading sequentially every byte of an 8GB file on a machine with <=
>> 8GB of RAM guarantee that any page cache data that existed on the
>> machine prior to the start of the 8GB read is now gone?
>
> It's not guaranteed that this will work - if the pages which you're trying
> to evict were accessed multiple times then it may take more page
> replacement to reliably shoot them down. But writing a 2xmemory file and
> then deleting it will be a reasonably effective way of evicting most of
> the other pagecache.
OK thanks, I'll take on good faith that this is the best scheme in
general. I was actually doing a somewhat different approach, reading
through a 2x memory "dummy" file before accessing the real file, but
based on your advice, I'll instead just create a 2x "dummy" file,
fsync it, and then delete it.
Thanks for the tips,
--
Benjamin Rutt
next prev parent reply other threads:[~2004-07-27 17:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-23 22:54 Benjamin Rutt
2004-07-24 5:21 ` Chris Wedgwood
2004-07-24 5:31 ` Tim Wright
2004-07-26 0:07 ` Benjamin Rutt
2004-07-26 1:40 ` Bernd Eckenfels
2004-07-26 12:47 ` Benjamin Rutt
2004-07-25 8:11 ` Andreas Haumer
2004-07-26 7:25 ` Andrew Morton
2004-07-26 13:02 ` Benjamin Rutt
2004-07-27 6:40 ` Andrew Morton
2004-07-27 7:16 ` Hans Reiser
2004-07-27 17:31 ` Benjamin Rutt
2004-07-27 18:03 ` Hans Reiser
2004-07-28 12:38 ` Benjamin Rutt
2004-07-28 17:03 ` Hans Reiser
2004-07-28 18:19 ` Benjamin Rutt
2004-07-27 17:25 ` Benjamin Rutt [this message]
2004-07-27 20:00 ` Timothy Miller
2004-07-28 12:51 ` Benjamin Rutt
2004-07-29 1:05 ` Nathan Scott
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=871xixpdky.fsf@osu.edu \
--to=rutt.4+news@osu.edu \
--cc=akpm@osdl.org \
--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®