From: Andrew Morton <akpm@osdl.org>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
paul.clements@steeleye.com
Subject: Re: [PATCH 002 of 8] md/bitmap: Remove bitmap writeback daemon.
Date: Fri, 12 May 2006 23:59:32 -0700 [thread overview]
Message-ID: <20060512235932.12f5a295.akpm@osdl.org> (raw)
In-Reply-To: <17509.20239.993465.843942@cse.unsw.edu.au>
Neil Brown <neilb@suse.de> wrote:
>
> On Friday May 12, akpm@osdl.org wrote:
> > NeilBrown <neilb@suse.de> wrote:
> > >
> > > ./drivers/md/bitmap.c | 115 ++----------------------------------------
> >
> > hmm. I hope we're not doing any of that filesystem I/O within the context
> > of submit_bio() or kblockd or anything like that. Looks OK from a quick
> > scan.
>
> No. We do all the I/O from the context of the per-array thread.
OK.
> However some IO requests cannot complete until the filesystem I/O
> completes, so we need to be sure that the filesystem I/O won't block
> waiting for memory, or fail with -ENOMEM.
That sounds like a complex deadlock. Suppose the bitmap writeout requres
some writeback to happen before it can get enough memory to proceed.
> bitmap.c is currently trying to do something every different.
> It uses ->readpage to get pages in the page cache (even though some
> address spaces don't define ->readpage) and then holds onto those
> pages without holding the page lock, and then calls ->writepage to
> flush them out from time to time.
That's OK.
> Before calling writepage it gets the pagelock, but doesn't re-check
> that ->mapping is correct (there is nothing much it can do if it isn't
> correct..).
We do that to find out if the page was truncated while we ewre waiting for
the page lock.
> I noticed this is particularly a problem with tmpfs. When you call
> writepage on a tmpfs page, the page is swizzled into the swap cache,
> and ->mapping becomes NULL - not the behaviour that bitmap is
> expecting.
You shouldn't call writepage on tmpfs. If !bdi_cap_writeback_dirty(), your
write_page() should immediately give up and "succeed". Because this
filesystem has no permanent backing store anyway.
tmpfs doesn't implement bmap(), so your new patch fixes that problem ;)
> > We normally use PAGE_CACHE_SIZE for these things, not PAGE_SIZE. Same diff.
> >
>
> Yeah.... why is that? Why have two names for exactly the same value?
I guess at one time it was thought that we could use a different unit size
for pagecache. Nowadays we use it by convention - it has little more than
documentary value.
> How does a poor develop know when to use one and when the other? More
> particularly, how does one remember.
If the page is a pagecache page, use PAGE_CACHE_SIZE. There are a few
spots where it blurs, but not many.
> > If you have a page and you want to write the whole thing out then there's
> > really no need to run prepare_write or commit_write at all. Just
> > initialise the whole page, run set_page_dirty() then write_one_page().
> >
>
> I see that now. But only after locking the page, and rechecking that
> ->mapping is correct, and if it isn't .... well, more work is involved
> that bitmap is in a position to do.
If you've bumped i_writecount to block truncate then there's no need to
check for truncation after locking the page.
i_mutex could be used similarly.
next prev parent reply other threads:[~2006-05-13 7:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-12 6:07 [PATCH 000 of 8] md/bitmap: Introduction - rework management of bitmap files NeilBrown
2006-05-12 6:07 ` [PATCH 001 of 8] md/bitmap: Fix online removal of file-backed bitmaps NeilBrown
2006-05-12 6:07 ` [PATCH 002 of 8] md/bitmap: Remove bitmap writeback daemon NeilBrown
2006-05-12 17:40 ` Andrew Morton
2006-05-13 3:14 ` Neil Brown
2006-05-13 6:59 ` Andrew Morton [this message]
2006-05-12 6:07 ` [PATCH 003 of 8] md/bitmap: Cleaner separation of page attribute handlers in md/bitmap NeilBrown
2006-05-12 6:07 ` [PATCH 004 of 8] md/bitmap: Use set_bit etc for bitmap page attributes NeilBrown
2006-05-12 6:07 ` [PATCH 005 of 8] md/bitmap: Remove unnecessary page reference manipulations from md/bitmap code NeilBrown
2006-05-12 6:07 ` [PATCH 006 of 8] md/bitmap: Remove dead code from md/bitmap NeilBrown
2006-05-12 6:08 ` [PATCH 007 of 8] md/bitmap: Tidy up i_writecount handling in md/bitmap NeilBrown
2006-05-12 6:08 ` [PATCH 008 of 8] md/bitmap: Change md/bitmap file handling to use bmap to file blocks NeilBrown
2006-05-12 17:47 ` Andrew Morton
2006-05-13 3:46 ` Neil Brown
2006-05-13 6:59 ` Andrew Morton
2006-05-13 15:29 ` Paul Clements
2006-05-13 15:42 ` Andrew Morton
2006-05-14 11:15 ` Neil Brown
2006-05-14 11:22 ` Andrew Morton
2006-05-15 0:26 ` Neil Brown
2006-05-15 21:04 ` Andrew Morton
2006-05-15 23:03 ` Neil Brown
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=20060512235932.12f5a295.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=paul.clements@steeleye.com \
/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