From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752532Ab1HJOPt (ORCPT ); Wed, 10 Aug 2011 10:15:49 -0400 Received: from mga14.intel.com ([143.182.124.37]:8149 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922Ab1HJOPs (ORCPT ); Wed, 10 Aug 2011 10:15:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,350,1309762800"; d="scan'208";a="37069769" Date: Wed, 10 Aug 2011 22:15:35 +0800 From: Wu Fengguang To: Peter Zijlstra Cc: "linux-fsdevel@vger.kernel.org" , Andrew Morton , Jan Kara , Christoph Hellwig , Dave Chinner , Greg Thelen , Minchan Kim , Vivek Goyal , Andrea Righi , linux-mm , LKML Subject: Re: [PATCH 3/5] writeback: dirty rate control Message-ID: <20110810141535.GD29724@localhost> References: <20110806084447.388624428@intel.com> <20110806094526.878435971@intel.com> <1312909322.1083.52.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1312909322.1083.52.camel@twins> 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 Wed, Aug 10, 2011 at 01:02:02AM +0800, Peter Zijlstra wrote: > On Sat, 2011-08-06 at 16:44 +0800, Wu Fengguang wrote: > > > + pos_bw = bw * pos_ratio >> BANDWIDTH_CALC_SHIFT; > > + pos_bw++; /* this avoids bdi->dirty_ratelimit get stuck in 0 */ > > + > > > + pos_ratio *= bdi->avg_write_bandwidth; > > + do_div(pos_ratio, dirty_bw | 1); > > + ref_bw = bw * pos_ratio >> BANDWIDTH_CALC_SHIFT; > > when written out that results in: > > bw * pos_ratio * bdi->avg_write_bandwidth > ref_bw = ----------------------------------------- > dirty_bw > > which would suggest you write it like: > > ref_bw = div_u64((u64)pos_bw * bdi->avg_write_bandwidth, dirty_bw | 1); > > since pos_bw is already bw * pos_ratio per the above. Good point. Oopse I even wrote a comment for the over complex calculation: * balanced_rate = pos_rate * write_bw / dirty_rate Thanks, Fengguang From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [PATCH 3/5] writeback: dirty rate control Date: Wed, 10 Aug 2011 22:15:35 +0800 Message-ID: <20110810141535.GD29724@localhost> References: <20110806084447.388624428@intel.com> <20110806094526.878435971@intel.com> <1312909322.1083.52.camel@twins> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "linux-fsdevel@vger.kernel.org" , Andrew Morton , Jan Kara , Christoph Hellwig , Dave Chinner , Greg Thelen , Minchan Kim , Vivek Goyal , Andrea Righi , linux-mm , LKML To: Peter Zijlstra Return-path: Content-Disposition: inline In-Reply-To: <1312909322.1083.52.camel@twins> Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Aug 10, 2011 at 01:02:02AM +0800, Peter Zijlstra wrote: > On Sat, 2011-08-06 at 16:44 +0800, Wu Fengguang wrote: > > > + pos_bw = bw * pos_ratio >> BANDWIDTH_CALC_SHIFT; > > + pos_bw++; /* this avoids bdi->dirty_ratelimit get stuck in 0 */ > > + > > > + pos_ratio *= bdi->avg_write_bandwidth; > > + do_div(pos_ratio, dirty_bw | 1); > > + ref_bw = bw * pos_ratio >> BANDWIDTH_CALC_SHIFT; > > when written out that results in: > > bw * pos_ratio * bdi->avg_write_bandwidth > ref_bw = ----------------------------------------- > dirty_bw > > which would suggest you write it like: > > ref_bw = div_u64((u64)pos_bw * bdi->avg_write_bandwidth, dirty_bw | 1); > > since pos_bw is already bw * pos_ratio per the above. Good point. Oopse I even wrote a comment for the over complex calculation: * balanced_rate = pos_rate * write_bw / dirty_rate Thanks, Fengguang -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org