From: Jan Kara <jack@suse.cz>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: Avoid livelocking of WB_SYNC_ALL writeback
Date: Sun, 7 Nov 2010 14:22:04 +0100 [thread overview]
Message-ID: <20101107132204.GC5126@quack.suse.cz> (raw)
In-Reply-To: <20101106041202.GA15411@localhost>
On Sat 06-11-10 12:12:02, Wu Fengguang wrote:
> On Sat, Nov 06, 2010 at 05:26:23AM +0800, Jan Kara wrote:
>
> > + /*
> > + * In WB_SYNC_ALL mode, we just want to ignore nr_to_write as
> > + * we need to write everything and livelock avoidance is implemented
> > + * differently.
> > + */
> > + if (wbc.sync_mode == WB_SYNC_NONE)
> > + write_chunk = MAX_WRITEBACK_PAGES;
> > + else
> > + write_chunk = LONG_MAX;
>
> This looks like a safe change for .37. I updated the patch on the
> above comment and made no other changes (it seems OK to also remove
> the below line, however that's not the necessary change as a bug fix,
> so I'd rather leave the extra change to the next merge window).
> write_cache_pages():
>
> --> /*
> --> * We stop writing back only if we are not doing
> --> * integrity sync. In case of integrity sync we have to
> --> * keep going until we have written all the pages
> --> * we tagged for writeback prior to entering this loop.
> --> */
> if (--wbc->nr_to_write <= 0 &&
> ==> wbc->sync_mode == WB_SYNC_NONE) {
> done = 1;
> break;
Well, I'd rather leave the test as is. In fact, in my mind-model the
target rather is to completely ignore nr_to_write when we do WB_SYNC_ALL
writeback since obeying it is never what a caller wants to happen...
> + /*
> + * WB_SYNC_ALL mode does livelock avoidance by syncing dirty
> + * inodes/pages in one big loop. Setting wbc.nr_to_write=LONG_MAX
> + * here avoids calling into writeback_inodes_wb() more than once.
Maybe I'd add here:
The intended call sequence for WB_SYNC_ALL writeback is:
> + *
> + * wb_writeback()
> + * writeback_inodes_wb() <== called only once
> + * write_cache_pages() <== called once for each inode
> + * (quickly) tag currently dirty pages
> + * (maybe slowly) sync all tagged pages
> + */
> + if (wbc.sync_mode == WB_SYNC_NONE)
> + write_chunk = MAX_WRITEBACK_PAGES;
> + else
> + write_chunk = LONG_MAX;
> +
Honza
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-11-07 13:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1288992383-25475-1-git-send-email-jack@suse.cz>
2010-11-06 1:36 ` [PATCH] mm: Avoid livelocking of WB_SYNC_ALL writeback Johannes Weiner
2010-11-07 13:07 ` Jan Kara
[not found] ` <20101105223038.GA16666@lst.de>
2010-11-06 2:55 ` Wu Fengguang
2010-11-06 16:39 ` Wu Fengguang
2010-11-07 13:34 ` Jan Kara
2010-11-06 4:12 ` Wu Fengguang
2010-11-07 13:22 ` Jan Kara [this message]
2010-11-07 13:37 ` Wu Fengguang
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=20101107132204.GC5126@quack.suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=hannes@cmpxchg.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.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