From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751707Ab1CDGWb (ORCPT ); Fri, 4 Mar 2011 01:22:31 -0500 Received: from ipmail05.adl6.internode.on.net ([150.101.137.143]:1105 "EHLO ipmail05.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824Ab1CDGWa (ORCPT ); Fri, 4 Mar 2011 01:22:30 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgEEABMUcE15LFEbgWdsb2JhbACmbhYBARYiJb5PDYVUBA Date: Fri, 4 Mar 2011 17:22:17 +1100 From: Dave Chinner To: Wu Fengguang Cc: Andrew Morton , Jan Kara , Chris Mason , Christoph Hellwig , Trond Myklebust , "Theodore Ts'o" , Peter Zijlstra , Mel Gorman , Rik van Riel , KOSAKI Motohiro , Greg Thelen , Minchan Kim , Vivek Goyal , Andrea Righi , Balbir Singh , linux-mm , linux-fsdevel@vger.kernel.org, LKML Subject: Re: [PATCH 06/27] btrfs: lower the dirty balance poll interval Message-ID: <20110304062217.GE25368@dastard> References: <20110303064505.718671603@intel.com> <20110303074949.419321686@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110303074949.419321686@intel.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 03, 2011 at 02:45:11PM +0800, Wu Fengguang wrote: > Call balance_dirty_pages_ratelimit_nr() on every 32 pages dirtied. > > Tests show that original larger intervals can easily make the bdi > dirty limit exceeded on 100 concurrent dd. > > CC: Chris Mason > Signed-off-by: Wu Fengguang > --- > fs/btrfs/file.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > --- linux-next.orig/fs/btrfs/file.c 2011-03-02 20:15:19.000000000 +0800 > +++ linux-next/fs/btrfs/file.c 2011-03-02 20:35:07.000000000 +0800 > @@ -949,9 +949,8 @@ static ssize_t btrfs_file_aio_write(stru > } > > iov_iter_init(&i, iov, nr_segs, count, num_written); > - nrptrs = min((iov_iter_count(&i) + PAGE_CACHE_SIZE - 1) / > - PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / > - (sizeof(struct page *))); > + nrptrs = min(DIV_ROUND_UP(iov_iter_count(&i), PAGE_CACHE_SIZE), > + min(32UL, PAGE_CACHE_SIZE / sizeof(struct page *))); You're basically hardcoding the maximum to 32 pages here, because PAGE_CACHE_SIZE / sizeof(page *) is always going to be much larger than 32. This means that you are effectively neutering the large write efficiencies of btrfs - you're reducing the delayed allocation sizes from 512 * PAGE_CACHE_SIZE down to 32 * PAGE_CACHE_SIZE. This will increase the overhead of the write process for btrfs for large IOs. Also, I've got some multipage write modifications that allow 1024 pages at a time between mapping/allocation calls with XFS - once again for improving the efficiencies of the extent mapping/allocations in the write path. If the new writeback throttling algorithms don't work with large numbers of pages being copied in a single go, then that's a problem. As it is, if 100 concurrent dd's can overrun the dirty limit w/ 512 pages at a time, then 1000 concurrent dd's w/ 32 pages at a time is just as likely to overrun it, too. We support 4096 CPU systems, so a few thousand concurrent writers is not out of the question. Hence I don't think just reducing the number of pages between dirty balance calls is a sufficient solution.... Cheers, Dave.. -- Dave Chinner david@fromorbit.com