From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [PATCH 3/5] writeback: fix dirtied pages accounting on sub-page writes Date: Tue, 22 Nov 2011 01:11:27 +0100 Message-ID: <20111122001127.GG4017@quack.suse.cz> References: <20111121130342.211953629@intel.com> <20111121131215.905222115@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, Jan Kara , Peter Zijlstra , Christoph Hellwig , Andrew Morton , LKML To: Wu Fengguang Return-path: Received: from cantor2.suse.de ([195.135.220.15]:34419 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751716Ab1KVALa (ORCPT ); Mon, 21 Nov 2011 19:11:30 -0500 Content-Disposition: inline In-Reply-To: <20111121131215.905222115@intel.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon 21-11-11 21:03:45, 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. > > Fix it by accounting nr_dirtied at page dirty time. Well, but after this change, the interface balance_dirty_ratelimited_nr() is strange because the argument is only used for per-CPU ratelimiting and not for per-task ratelimiting... So if you do this switch then I'd also switch bdp_ratelimits to get consistent results and a clean interface and completely kill balance_dirty_pages_ratelimited_nr(). Honza > > Signed-off-by: Wu Fengguang > --- > mm/page-writeback.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > --- linux-next.orig/mm/page-writeback.c 2011-11-17 20:57:13.000000000 +0800 > +++ linux-next/mm/page-writeback.c 2011-11-17 20:57:15.000000000 +0800 > @@ -1224,8 +1224,6 @@ void balance_dirty_pages_ratelimited_nr( > if (bdi->dirty_exceeded) > ratelimit = min(ratelimit, 32 >> (PAGE_SHIFT - 10)); > > - current->nr_dirtied += nr_pages_dirtied; > - > preempt_disable(); > /* > * This prevents one CPU to accumulate too many dirtied pages without > @@ -1734,6 +1732,7 @@ void account_page_dirtied(struct page *p > __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE); > __inc_bdi_stat(mapping->backing_dev_info, BDI_DIRTIED); > task_io_account_write(PAGE_CACHE_SIZE); > + current->nr_dirtied++; > } > } > EXPORT_SYMBOL(account_page_dirtied); > > -- Jan Kara SUSE Labs, CR