From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH] mm: Avoid livelocking of WB_SYNC_ALL writeback Date: Sat, 6 Nov 2010 12:45:18 +0100 Message-ID: <20101106114518.GA1427@lst.de> References: <1288992383-25475-1-git-send-email-jack@suse.cz> <20101105223038.GA16666@lst.de> <20101106025423.GA14567@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , Jan Kara , "linux-fsdevel@vger.kernel.org" , Andrew Morton To: Wu Fengguang Return-path: Received: from verein.lst.de ([213.95.11.210]:54890 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753192Ab0KFLp4 (ORCPT ); Sat, 6 Nov 2010 07:45:56 -0400 Content-Disposition: inline In-Reply-To: <20101106025423.GA14567@localhost> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sat, Nov 06, 2010 at 10:54:23AM +0800, Wu Fengguang wrote: > > I think it would be useful to elaborate here on how livelock avoidance > > is supposed to work. > > It's supposed to sync files in a big loop > > for each dirty inode > write_cache_pages() > (quickly) tag currently dirty pages > (maybe slowly) sync all tagged pages > > Ideally the loop should call write_cache_pages() _once_ for each inode. > At least this is the assumption made by commit f446daaea (mm: > implement writeback livelock avoidance using page tagging). > > Setting wbc.nr_to_write to LONG_MAX ensures that writeback_inodes_wb() > will complete the above loop before returning to wb_writeback(), and > to prevent wb_writeback() from looping (thus re-syncing extra data) in > the below range of code. I know this, but putting a shortened version of this into the comment would generally be helpful. It should at least mention that the page tagging is taking care of it.