From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [PATCH 1/2] writeback: Improve busyloop prevention Date: Wed, 19 Oct 2011 21:30:19 +0800 Message-ID: <20111019133019.GB13259@localhost> References: <1318453043-32057-1-git-send-email-jack@suse.cz> <1318453043-32057-2-git-send-email-jack@suse.cz> <20111013142638.GB6938@localhost> <20111013143939.GA9691@localhost> <20111013201835.GD27363@quack.suse.cz> <20111014160047.GA13330@localhost> <20111014162807.GA4617@localhost> <20111018005128.GI4528@quack.suse.cz> <20111018143504.GA17818@localhost> <20111019115630.GA22266@quack.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "linux-fsdevel@vger.kernel.org" , Christoph Hellwig , Dave Chinner To: Jan Kara Return-path: Received: from mga14.intel.com ([143.182.124.37]:28858 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753067Ab1JSNaX (ORCPT ); Wed, 19 Oct 2011 09:30:23 -0400 Content-Disposition: inline In-Reply-To: <20111019115630.GA22266@quack.suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: > From 7b559f1cea41cdba7b39138ad1637f8000e218b9 Mon Sep 17 00:00:00 2001 > From: Jan Kara > Date: Wed, 19 Oct 2011 11:44:41 +0200 > Subject: [PATCH] writeback: Include all dirty inodes in background writeback > > Current livelock avoidance code makes background work to include only inodes > that were dirtied before background writeback has started. However background > writeback can be running for a long time and thus excluding newly dirtied > inodes can eventually exclude significant portion of dirty inodes making > background writeback inefficient. Since background writeback avoids livelocking > the flusher thread by yielding to any other work, there is no real reason why > background work should not include all dirty inodes so change the logic in > wb_writeback(). Looks good to me. Thanks! > Signed-off-by: Jan Kara > --- > fs/fs-writeback.c | 10 ++++++++-- > 1 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > index 04cf3b9..8314241 100644 > --- a/fs/fs-writeback.c > +++ b/fs/fs-writeback.c > @@ -730,11 +730,17 @@ static long wb_writeback(struct bdi_writeback *wb, > if (work->for_background && !over_bground_thresh()) > break; > > + /* > + * Kupdate and background works are special and we want to > + * include all inodes that need writing. Livelock avoidance is > + * handled by these works yielding to any other work so we are > + * safe. > + */ > if (work->for_kupdate) { > oldest_jif = jiffies - > msecs_to_jiffies(dirty_expire_interval * 10); > - work->older_than_this = &oldest_jif; > - } > + } else if (work->for_background) > + oldest_jif = jiffies; > > trace_writeback_start(wb->bdi, work); > if (list_empty(&wb->b_io)) > -- > 1.7.1 >