From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [PATCH 3/7] writeback: fix dirtied pages accounting on sub-page writes Date: Thu, 8 Dec 2011 10:44:25 +0800 Message-ID: <20111208024425.GA7717@localhost> References: <20111128135338.249672012@intel.com> <20111128140513.275099009@intel.com> <20111207105340.GF4622@quack.suse.cz> <20111207120818.GB6549@localhost> <20111207160753.GJ4622@quack.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "linux-fsdevel@vger.kernel.org" , Peter Zijlstra , Christoph Hellwig , Andrew Morton , LKML To: Jan Kara Return-path: Content-Disposition: inline In-Reply-To: <20111207160753.GJ4622@quack.suse.cz> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu, Dec 08, 2011 at 12:07:53AM +0800, Jan Kara wrote: > On Wed 07-12-11 20:08:18, Wu Fengguang wrote: > > On Wed, Dec 07, 2011 at 06:53:40PM +0800, Jan Kara wrote: > > > On Mon 28-11-11 21:53:41, Wu Fengguang wrote: > > > > When dd in 512bytes, generic_perform_write() calls > > > > balance_dirty_pages_ratelimited() 8 times for the same page, but > > > > obviously the page is only dirtied once. > > > Actually, for ppc where pages can be 64 KB the problem is even worse. > > > > Ah yes. > > > > > > Fix it by accounting tsk->nr_dirtied and bdp_ratelimits at page dirty time. > > > I was wondering about one more thing - couldn't we rather check in > > > generic_perform_write() whether the page was dirty before calling > > > ->write_end and call balance_dirty_pages_ratelimited() only if it wasn't? > > > > Cough.. the very original version does that exactly, then you raised > > some concern here: > > > > https://lkml.org/lkml/2011/4/13/554 > > > > The discussion goes on and eventually I get to the current version > > that looks most acceptable in the three options. > Good point. I should have researched web (or my memory) more closely ;) > Thanks for the pointer - it has reminded me why using PageDirty isn't quite > perfect. > > > > For generic_perform_write() it doesn't really matter that much since we > > > do things page-by-page anyway but other callers could be more efficient... > > > > That's right. > You can add: > Acked-by: Jan Kara OK, thanks! Fengguang