From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Nick Piggin <npiggin@suse.de>
Cc: Andrew Morton <akpm@osdl.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/9] readahead: clean up and simplify the code for filemap page fault readahead
Date: Wed, 19 Dec 2007 14:55:17 +0800 [thread overview]
Message-ID: <398047328.03778@ustc.edu.cn> (raw)
Message-ID: <E1J4spp-0001pR-JQ@localhost> (raw)
In-Reply-To: <20071218235423.GB20838@wotan.suse.de>
On Wed, Dec 19, 2007 at 12:54:23AM +0100, Nick Piggin wrote:
> On Tue, Dec 18, 2007 at 07:50:33PM +0800, Fengguang Wu wrote:
> > On Tue, Dec 18, 2007 at 09:19:07AM +0100, Nick Piggin wrote:
> > > On Sun, Dec 16, 2007 at 07:59:30PM +0800, Fengguang Wu wrote:
> >
> > > > + read_lock_irq(&mapping->tree_lock);
> > > > + page = radix_tree_lookup(&mapping->page_tree, offset);
> > > > + if (likely(page)) {
> > > > + int got_lock, uptodate;
> > > > + page_cache_get(page);
> > > > +
> > > > + got_lock = !TestSetPageLocked(page);
> > > > + uptodate = PageUptodate(page);
> > > > + read_unlock_irq(&mapping->tree_lock);
> > >
> > > If we could avoid open coding tree_lock here (and expanding its coverage
> > > to PageUptodate), that would be nice. I don't think it gains us too much.
> >
> > To use find_get_page()? That would be nice to me, too.
>
> Exactly.
Done. Also I think it's better not to split the `found' case into
the two cases of 'found & lock-ok' and 'found & wait-lock' for now.
That would reduce some more code:
-/*
- * A successful mmap hit is when we didn't need any IO at all,
- * and got an immediate lock on an up-to-date page. There's not
- * much to do, except decide on whether we want to trigger read-
- * ahead.
- *
- * We currently do the same thing as we did for a locked page
- * that we're waiting for.
- */
-static void do_mmap_hit(struct vm_area_struct *vma,
- struct file_ra_state *ra,
- struct file *file,
- struct page *page,
- pgoff_t offset)
-{
- do_async_mmap_readahead(vma, ra, file, page, offset);
-}
-
/**
* filemap_fault - read in file data for page fault handling
* @vma: vma in which the fault was taken
@@ -1411,28 +1396,13 @@
return VM_FAULT_SIGBUS;
/*
- * Do we have something in the page cache already that
- * is unlocked and already up-to-date?
+ * Do we have something in the page cache already?
*/
page = find_get_page(mapping, offset);
if (likely(page)) {
- if (likely(!TestSetPageLocked(page))) {
- /*
- * Previous IO error? No read-ahead, but try to
- * re-do a single read.
- */
- if (unlikely(!PageUptodate(page)))
- goto page_not_uptodate;
-
- do_mmap_hit(vma, ra, file, page, offset);
- goto found_it;
- }
-
/*
- * We found the page, but it was locked..
- *
- * So do async readahead and wait for it to
- * unlock.
+ * We found the page, so try async readahead before
+ * waiting for the lock.
*/
do_async_mmap_readahead(vma, ra, file, page, offset);
lock_page(page);
next prev parent reply other threads:[~2007-12-19 6:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071216115927.986126305@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 0/9] mmap read-around and readahead Fengguang Wu
2007-12-16 23:35 ` Linus Torvalds
[not found] ` <E1J4atl-0000UI-4a@localhost>
2007-12-18 11:46 ` Fengguang Wu
[not found] ` <20071218114609.GA27778@mail.ustc.edu.cn>
[not found] ` <E1J4bK6-0001BG-Mp@localhost>
2007-12-18 12:13 ` Fengguang Wu
[not found] ` <E1J4tUN-0002IB-F6@localhost>
2007-12-19 7:37 ` Fengguang Wu
[not found] ` <20071216120417.586021813@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 1/9] readahead: simplify readahead call scheme Fengguang Wu
[not found] ` <20071216120417.905514988@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 3/9] readahead: auto detection of sequential mmap reads Fengguang Wu
[not found] ` <20071216120418.055796608@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 4/9] readahead: quick startup on sequential mmap readahead Fengguang Wu
[not found] ` <20071216120418.201213716@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 5/9] readahead: make ra_submit() non-static Fengguang Wu
[not found] ` <20071216120418.360445517@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 6/9] readahead: save mmap read-around states in file_ra_state Fengguang Wu
[not found] ` <20071216120418.498110756@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 7/9] readahead: remove unused do_page_cache_readahead() Fengguang Wu
[not found] ` <20071216120418.639781633@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 8/9] readahead: move max_sane_readahead() calls into force_page_cache_readahead() Fengguang Wu
[not found] ` <20071216120418.787765636@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 9/9] readahead: call max_sane_readahead() in ondemand_readahead() Fengguang Wu
[not found] ` <20071216120417.748714367@mail.ustc.edu.cn>
2007-12-16 11:59 ` [PATCH 2/9] readahead: clean up and simplify the code for filemap page fault readahead Fengguang Wu
2007-12-18 8:19 ` Nick Piggin
[not found] ` <E1J4ay1-0000ak-3e@localhost>
2007-12-18 11:50 ` Fengguang Wu
2007-12-18 23:54 ` Nick Piggin
[not found] ` <E1J4spp-0001pR-JQ@localhost>
2007-12-19 6:55 ` Fengguang Wu [this message]
[not found] <20071222013147.897522982@mail.ustc.edu.cn>
[not found] ` <20071222013314.688868252@mail.ustc.edu.cn>
2007-12-22 1:31 ` Fengguang Wu
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=398047328.03778@ustc.edu.cn \
--to=wfg@mail.ustc.edu.cn \
--cc=akpm@linux-foundation.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=torvalds@linux-foundation.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