From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [PATCH 05/10] writeback: per task dirty rate limit Date: Fri, 26 Aug 2011 20:59:24 +0800 Message-ID: <20110826125924.GA6014@localhost> References: <20110826113813.895522398@intel.com> <20110826114619.268843347@intel.com> <1314363069.11049.3.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: <1314363069.11049.3.camel@twins> Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org On Fri, Aug 26, 2011 at 08:51:09PM +0800, Peter Zijlstra wrote: > On Fri, 2011-08-26 at 19:38 +0800, Wu Fengguang wrote: > > + preempt_disable(); > > /* > > - * Check the rate limiting. Also, we do not want to throttle real-time > > - * tasks in balance_dirty_pages(). Period. > > + * This prevents one CPU to accumulate too many dirtied pages without > > + * calling into balance_dirty_pages(), which can happen when there are > > + * 1000+ tasks, all of them start dirtying pages at exactly the same > > + * time, hence all honoured too large initial task->nr_dirtied_pause. > > */ > > - preempt_disable(); > > p = &__get_cpu_var(bdp_ratelimits); > > p = &get_cpu_var(bdp_ratelimits); Ah yeah.. I actually followed your suggestion, and then find we'll eventually do two __get_cpu_var() calls here, one for bdp_ratelimits and the other for dirty_leaks in a planned patch. So let's keep the preempt_disable()/preempt_enable(). > > - *p += nr_pages_dirtied; > > - if (unlikely(*p >= ratelimit)) { > > - ratelimit = sync_writeback_pages(*p); > > + if (unlikely(current->nr_dirtied >= ratelimit)) > > *p = 0; > > - preempt_enable(); > > - balance_dirty_pages(mapping, ratelimit); > > - return; > > + else { > > + *p += nr_pages_dirtied; > > + if (unlikely(*p >= ratelimit_pages)) { > > + *p = 0; > > + ratelimit = 0; > > + } > > } > > preempt_enable(); > > put_cpu_var(bdp_ratelimits); ditto. 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