From: Wu Fengguang <fengguang.wu@intel.com>
To: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Dave Chinner <david@fromorbit.com>,
Christoph Hellwig <hch@infradead.org>, Mel Gorman <mel@csn.ul.ie>,
Chris Mason <chris.mason@oracle.com>,
Jens Axboe <axboe@kernel.dk>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH 12/13] writeback: try more writeback as long as something was written
Date: Fri, 6 Aug 2010 06:39:29 +0800 [thread overview]
Message-ID: <20100805223929.GC5586@localhost> (raw)
In-Reply-To: <20100805170016.GE3535@quack.suse.cz>
On Fri, Aug 06, 2010 at 01:00:16AM +0800, Jan Kara wrote:
> On Fri 06-08-10 00:11:03, Wu Fengguang wrote:
> > writeback_inodes_wb()/__writeback_inodes_sb() are not aggressive in that
> > they only populate b_io when necessary at entrance time. When the queued
> > set of inodes are all synced, they just return, possibly with
> > wbc.nr_to_write > 0.
> >
> > For kupdate and background writeback, there may be more eligible inodes
> > sitting in b_dirty when the current set of b_io inodes are completed. So
> > it is necessary to try another round of writeback as long as we made some
> > progress in this round. When there are no more eligible inodes, no more
> > inodes will be enqueued in queue_io(), hence nothing could/will be
> > synced and we may safely bail.
> This looks like a sane thing to do. Just one comment below...
>
> > Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> > ---
> > fs/fs-writeback.c | 19 +++++++++++--------
> > 1 file changed, 11 insertions(+), 8 deletions(-)
> >
> > --- linux-next.orig/fs/fs-writeback.c 2010-08-05 23:30:27.000000000 +0800
> > +++ linux-next/fs/fs-writeback.c 2010-08-05 23:30:45.000000000 +0800
> > @@ -654,20 +654,23 @@ static long wb_writeback(struct bdi_writ
> > wrote += MAX_WRITEBACK_PAGES - wbc.nr_to_write;
> >
> > /*
> > - * If we consumed everything, see if we have more
> > + * Did we write something? Try for more
> > + *
> > + * This is needed _before_ the b_more_io test because the
> > + * background writeback moves inodes to b_io and works on
> Well, this applies generally to any writeback, not just a background one
> right? Whenever we process all inodes from b_io list and move them
> somewhere else than b_more_io, then this applies. Some new dirty data could
> have arrived while we were doing the write...
Right. Only that it is a requirement for background writeback.
For others this patch is not a necessity.
> I'm just afraid that in some
> pathological cases this could result in bad writeback pattern - like if
> there is some process which manages to dirty just a few pages while we are
> doing writeout, this looping could result in writing just a few pages in
> each round which is bad for fragmentation etc.
Such inodes will be redirty_tail()ed here:
if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
/*
* We didn't write back all the pages. nfs_writepages()
* sometimes bales out without doing anything.
*/
inode->i_state |= I_DIRTY_PAGES;
if (wbc->nr_to_write <= 0) {
/*
* slice used up: queue for next turn
*/
requeue_io(inode);
} else {
/*
* Writeback blocked by something other than
* congestion. Delay the inode for some time to
* avoid spinning on the CPU (100% iowait)
* retrying writeback of the dirty page/inode
* that cannot be performed immediately.
*/
redirty_tail(inode);
}
> Actually, this comment probably also applies to your patch where you
> change the queueing logic in writeback_single_inode(), doesn't it?
Can you elaborate?
Thanks,
Fengguang
>
> > + * them in batches (in order to sync old pages first). The
> > + * completion of the current batch does not necessarily mean
> > + * the overall work is done.
> > */
> > - if (wbc.nr_to_write <= 0)
> > + if (wbc.nr_to_write < MAX_WRITEBACK_PAGES)
> > continue;
> > +
> > /*
> > - * Didn't write everything and we don't have more IO, bail
> > + * Nothing written and no more inodes for IO, bail
> > */
> > if (list_empty(&wb->b_more_io))
> > break;
> > - /*
> > - * Did we write something? Try for more
> > - */
> > - if (wbc.nr_to_write < MAX_WRITEBACK_PAGES)
> > - continue;
> > +
> > /*
> > * Nothing written. Wait for some inode to
> > * become available for writeback. Otherwise
> >
> >
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
--
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>
next prev parent reply other threads:[~2010-08-05 22:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 16:10 [PATCH 00/13] writeback patches for 2.6.36 Wu Fengguang
2010-08-05 16:10 ` [PATCH 01/13] writeback: reduce calls to global_page_state in balance_dirty_pages() Wu Fengguang
2010-08-05 16:10 ` [PATCH 02/13] writeback: avoid unnecessary calculation of bdi dirty thresholds Wu Fengguang
2010-08-06 10:14 ` Peter Zijlstra
2010-08-05 16:10 ` [PATCH 03/13] writeback: add comment to the dirty limits functions Wu Fengguang
2010-08-06 10:17 ` Peter Zijlstra
2010-08-07 16:47 ` Wu Fengguang
2010-08-05 16:10 ` [PATCH 04/13] writeback: dont redirty tail an inode with dirty pages Wu Fengguang
2010-08-05 16:10 ` [PATCH 05/13] writeback: fix queue_io() ordering Wu Fengguang
2010-08-05 16:10 ` [PATCH 06/13] writeback: merge for_kupdate and !for_kupdate cases Wu Fengguang
2010-08-05 16:10 ` [PATCH 07/13] writeback: explicit low bound for vm.dirty_ratio Wu Fengguang
2010-08-05 23:34 ` Andrew Morton
2010-08-06 12:44 ` Wu Fengguang
2010-08-10 3:12 ` KOSAKI Motohiro
2010-08-10 3:57 ` Neil Brown
2010-08-10 13:29 ` Jan Kara
2010-08-10 18:12 ` Wu Fengguang
2010-08-10 18:06 ` Wu Fengguang
2010-08-05 16:10 ` [PATCH 08/13] writeback: pass writeback_control down to move_expired_inodes() Wu Fengguang
2010-08-05 16:11 ` [PATCH 09/13] writeback: the kupdate expire timestamp should be a moving target Wu Fengguang
2010-08-05 16:11 ` [PATCH 10/13] writeback: kill writeback_control.more_io Wu Fengguang
2010-08-05 16:11 ` [PATCH 11/13] writeback: sync expired inodes first in background writeback Wu Fengguang
2010-08-05 16:11 ` [PATCH 12/13] writeback: try more writeback as long as something was written Wu Fengguang
2010-08-05 17:00 ` Jan Kara
2010-08-05 22:39 ` Wu Fengguang [this message]
2010-08-05 22:50 ` Jan Kara
2010-08-05 16:11 ` [PATCH 13/13] writeback: introduce writeback_control.inodes_written Wu Fengguang
2010-08-05 23:08 ` [PATCH 00/13] writeback patches for 2.6.36 Andrew Morton
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=20100805223929.GC5586@localhost \
--to=fengguang.wu@intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=chris.mason@oracle.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
/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;
as well as URLs for NNTP newsgroup(s).