From: Jan Kara <jack@suse.cz>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: tytso@mit.edu, Jan Kara <jack@suse.cz>,
Jens Axboe <jens.axboe@oracle.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
jengelh@medozas.de, stable@kernel.org, gregkh@suse.de
Subject: Re: [PATCH] writeback: Fix broken sync writeback
Date: Mon, 22 Feb 2010 18:29:38 +0100 [thread overview]
Message-ID: <20100222172938.GA2601@quack.suse.cz> (raw)
In-Reply-To: <alpine.LFD.2.00.1002162052230.4141@localhost.localdomain>
On Tue 16-02-10 21:16:46, Linus Torvalds wrote:
> On Tue, 16 Feb 2010, tytso@mit.edu wrote:
> >
> > We've had this logic for a long time, and given the increase in disk
> > density, and spindle speeds, the 4MB limit, which might have made
> > sense 10 years ago, probably doesn't make sense now.
>
> I still don't think that 4MB is enough on its own to suck quite that
> much. Even a fast device should be perfectly happy with 4MB IOs, or it
> must be sucking really badly.
>
> In order to see the kinds of problems that got quoted in the original
> thread, there must be something else going on too, methinks (disk light
> was "blinking").
<snip>
> Are we perhaps ending up in a situation where we essentially wait
> synchronously on just the inode itself being written out? That would
> explain the "40kB/s" kind of behavior.
>
> If we were actually doing real 4MB chunks, that would _not_ explain 40kB/s
> throughput.
Yes, it is actually 400kB/s but still you're right that that seems too
low if the only problem were seeks. I was looking at the code and it's even
bigger mess than what I thought :(.
a) ext4_da_writepages returns after writing 32 MB even in WB_SYNC_ALL mode
(when 1024 is passed in nr_to_write). Writeback code kind of expects that
in WB_SYNC_ALL mode all dirty pages in the given range are written (the
same way as write_cache_pages does that).
b) because of delayed allocation, inode is redirtied during ->writepages
call and thus writeback_single_inode calls redirty_tail at it. Thus each
inode will be written at least twice (synchronously, which means a
transaction commit and a disk cache flush for each such write).
c) the livelock avoidace in writeback_inodes_wb does not work because the
function exists as soon as nr_to_write (set to 1024) gets to 0 and thus
the 'start' timestamp gets always renewed.
d) ext4_writepage never succeeds to write a page with delayed-allocated
data. So pageout() function never succeeds in cleaning a page on ext4.
I think that when other problems in writeback code make writeout slow (like
in Jan Engelhardt's case), this can bite us and I assume this might be the
reason why Jan saw kswapd active doing some work during his problems.
> But if we do a 4MB chunk (for the one file that had real dirty data in
> it), and then do a few hundred trivial "write out the inode data
> _synchronously_" (due to access time changes etc) in between until we hit
> the file that has real dirty data again - now _that_ would explain 40kB/s
> throughput. It's not just seeking around - it's not even trying to push
> multiple IO's to get any elevator going or anything like that.
>
> And then the patch that started this discussion makes sense: it improves
> performance because in between those synchronous inode updates it now
> writes big chunks. But again, it's mostly hiding us just doing insane
> things.
I'm not quite sure whether some of the above problems is really causing the
sync writeback to be so slow. At least problems a) and c) would be
worked-around by the patch setting nr_to_write to LONG_MAX for sync
writeback and the effect of b) would be mitigated to just two synchronous
inode writes instead of (dirty_pages + 8191) / 8192 + 1 sync writes.
For c) I think the original patch is actually the right solution but I
agree that it just hides the other problems...
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2010-02-22 17:31 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-12 9:16 Jens Axboe
2010-02-12 15:45 ` Linus Torvalds
2010-02-13 12:58 ` Jan Engelhardt
2010-02-15 14:49 ` Jan Kara
2010-02-15 15:41 ` Jan Engelhardt
2010-02-15 15:58 ` Jan Kara
2010-06-27 16:44 ` Jan Engelhardt
2010-10-24 23:41 ` Sync writeback still broken Jan Engelhardt
2010-10-30 0:57 ` Linus Torvalds
2010-10-30 1:16 ` Linus Torvalds
2010-10-30 1:30 ` Linus Torvalds
2010-10-30 3:18 ` Andrew Morton
2010-10-30 13:15 ` Christoph Hellwig
2010-10-31 12:24 ` Jan Kara
2010-10-31 22:40 ` Jan Kara
2010-11-05 21:33 ` Jan Kara
2010-11-05 21:34 ` Jan Kara
2010-11-05 21:41 ` Linus Torvalds
2010-11-05 22:03 ` Jan Engelhardt
2010-11-07 12:57 ` Jan Kara
2011-01-20 22:50 ` Jan Engelhardt
2011-01-21 15:09 ` Jan Kara
2010-02-15 14:17 ` [PATCH] writeback: Fix broken sync writeback Jan Kara
2010-02-16 0:05 ` Linus Torvalds
2010-02-16 23:00 ` Jan Kara
2010-02-16 23:34 ` Linus Torvalds
2010-02-17 0:01 ` Linus Torvalds
2010-02-17 1:33 ` Jan Kara
2010-02-17 1:57 ` Dave Chinner
2010-02-17 3:35 ` Linus Torvalds
2010-02-17 4:30 ` tytso
2010-02-17 5:16 ` Linus Torvalds
2010-02-22 17:29 ` Jan Kara [this message]
2010-02-22 21:01 ` tytso
2010-02-22 22:26 ` Jan Kara
2010-02-23 2:53 ` Dave Chinner
2010-02-23 3:23 ` tytso
2010-02-23 5:53 ` Dave Chinner
2010-02-24 14:56 ` Jan Kara
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=20100222172938.GA2601@quack.suse.cz \
--to=jack@suse.cz \
--cc=gregkh@suse.de \
--cc=jengelh@medozas.de \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
/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®