From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 21/45] writeback: estimate bdi write bandwidth Date: Wed, 07 Oct 2009 10:53:19 +0200 Message-ID: <1254905599.26976.216.camel@twins> References: <20091007073818.318088777@intel.com> <20091007074903.867171763@intel.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Andrew Morton , Theodore Tso , Christoph Hellwig , Dave Chinner , Chris Mason , Li Shaohua , Myklebust Trond , "jens.axboe@oracle.com" , Jan Kara , Nick Piggin , linux-fsdevel@vger.kernel.org To: Wu Fengguang Return-path: Received: from viefep20-int.chello.at ([62.179.121.40]:52570 "EHLO viefep20-int.chello.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934192AbZJGI4r (ORCPT ); Wed, 7 Oct 2009 04:56:47 -0400 In-Reply-To: <20091007074903.867171763@intel.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, 2009-10-07 at 15:38 +0800, Wu Fengguang wrote: > +static void bdi_calc_write_bandwidth(struct backing_dev_info *bdi, > + unsigned long nr_pages, > + unsigned long time) > +{ > + unsigned long bw; > + > + bw = HZ * nr_pages / (time | 1); > + bdi->write_bandwidth = (bdi->write_bandwidth * 63 + bw) / 64; > +} If you have block times < 1 jiffy this all falls apart quite quickly. You could perhaps try to use cpu_clock() for ns resolution timestamps if this is a real issue. (I could imagine fast arrays with huge throughput causing small sleeps, resulting in underestimates of their bandwidth) Also, 63/64 seems rather slow progress.. maybe that's good.