From: Steve VanDeBogart <vandebo-lkml@NerdBox.Net>
To: Jamie Lokier <jamie@shareable.org>
Cc: Chris Frost <frost@cs.ucla.edu>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Benny Halevy <bhalevy@panasas.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs: add fincore(2) (mincore(2) for file descriptors)
Date: Thu, 28 Jan 2010 00:23:55 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.1.00.1001272343050.2909@abydos.NerdBox.Net> (raw)
In-Reply-To: <20100127181424.GA21585@shareable.org>
On Wed, 27 Jan 2010, Jamie Lokier wrote:
> Chris Frost wrote:
>> We introduced this system call while modifying SQLite and the GIMP to
>> request large prefetches for what would otherwise be non-sequential reads.
>> As a macrobenchmark, we see a 125s SQLite query (72s system time) reduced
>> to 75s (18s system time) by using fincore() instead of mincore(). This
>> speedup of course varies by benchmark and benchmarks size; we've seen
>> both minimal speedups and 1000x speedups. More on these benchmarks in the
>> publication _Reducing Seek Overhead with Application-Directed Prefetching_
>> in USENIX ATC 2009 and at http://libprefetch.cs.ucla.edu/.
>
> My first thought was:
>
> Why is calling fincore() and then issuing reads better than simply
> calling readahead() on the same range? I.e. why is readahead() (or
> POSIX_FADV_WILLNEED) unsuitable to give the same result? Or even
> issuing lots of AIO requests.
A stupid example can illustrate the difference. If you have X bytes
of RAM, and have a file 10 X in size, reading the entire thing in
before accessing it will only hurt performance. (The same situation
where an MRU replacement policy can perform better then a strict LRU
policy.) In other words, using fincore helps the prefetching library
figure out how much to prefetch to optimize performance.
> I knew that I was missing something, so I read the paper ;-) I don't
> fully understand it, but *think* that it says fincore() is used to
> detect when the kernel is evicting pages faster than libprefetch had
> planned for, implying memory pressure, so it adjusts its planning in
> response.
In some sense, yes. At core, Libprefetch uses fincore to detect how much
memory can be used for prefetching. We can ask proc how much is
free and how much is in buffers, but memory use is dynamic, so
libprefetch must monitor it and react appropriately.
> Interesting idea, though I wonder if it wouldn't be even better to
> have a direct way to ask the kernel "tell me when there is memory
> pressure causing my file to be evicted".
Such an interface sounds fairly specialized. It's possible that it would
be more efficient for this particular purpose, but useless for other,
related, purposes. For example, if you want to backup a file without
polluting the buffer cache: before accessing each page of the file,
fincore that page, send it to the backup device, then restore the page
to its previous state with fadvise. fincore is obviously modelled on
mincore, which has stood the test of time as an interface. Even if you
don't like the mincore/fincore interface, you have to admit it can't be
that bad because no replacement interface has been accepted.
--
Steve
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2010-01-28 8:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 21:57 Chris Frost
2010-01-21 1:11 ` Andi Kleen
2010-02-16 18:13 ` Chris Frost
2010-02-21 3:02 ` Andy Isaacson
2010-02-21 3:25 ` Wu Fengguang
2010-02-23 16:39 ` Andy Isaacson
2010-05-07 22:46 ` Cédric Villemain
2010-01-22 1:17 ` Wu Fengguang
2010-01-22 1:29 ` Paul E. McKenney
2010-01-26 22:12 ` Andrew Morton
2010-01-28 7:42 ` Steve VanDeBogart
2010-01-28 8:23 ` Andrew Morton
2010-01-28 8:32 ` Steve VanDeBogart
2010-01-28 23:54 ` Andres Freund
2010-01-27 18:14 ` Jamie Lokier
2010-01-28 8:23 ` Steve VanDeBogart [this message]
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=alpine.DEB.1.00.1001272343050.2909@abydos.NerdBox.Net \
--to=vandebo-lkml@nerdbox.net \
--cc=akpm@linux-foundation.org \
--cc=bhalevy@panasas.com \
--cc=frost@cs.ucla.edu \
--cc=heiko.carstens@de.ibm.com \
--cc=jamie@shareable.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@zeniv.linux.org.uk \
/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