[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110810141535.GD29724@localhost>
Date: Wed, 10 Aug 2011 22:15:35 +0800
From: Wu Fengguang <fengguang.wu@...el.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Jan Kara <jack@...e.cz>, Christoph Hellwig <hch@....de>,
Dave Chinner <david@...morbit.com>,
Greg Thelen <gthelen@...gle.com>,
Minchan Kim <minchan.kim@...il.com>,
Vivek Goyal <vgoyal@...hat.com>,
Andrea Righi <arighi@...eler.com>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/5] writeback: dirty rate control
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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists