From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: [PATCH 10/13] writeback: make reasonable gap between the dirty/background thresholds Date: Wed, 17 Nov 2010 11:58:31 +0800 Message-ID: <20101117035906.587564574@intel.com> Return-path: Received: from kanga.kvack.org ([205.233.56.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PIZK3-0007d3-LC for glkm-linux-mm-2@m.gmane.org; Wed, 17 Nov 2010 05:08:40 +0100 Received: from mail144.messagelabs.com (mail144.messagelabs.com [216.82.254.51]) by kanga.kvack.org (Postfix) with SMTP id EC2E56B010B for ; Tue, 16 Nov 2010 23:08:10 -0500 (EST) Sender: owner-linux-mm@kvack.org To: Andrew Morton Cc: Theodore Ts'o , Wu Fengguang , Dave Chinner , Jan Kara , Peter Zijlstra , Mel Gorman , Rik van Riel , KOSAKI Motohiro , Chris Mason , Christoph Hellwig , linux-mm , linux-fsdevel@vger.kernel.org, LKML List-Id: linux-mm.kvack.org Andrew, References: <20101117035821.000579293@intel.com> Content-Disposition: inline; filename=writeback-fix-oversize-background-thresh.patch The change is virtually a no-op for the majority users that use the default 10/20 background/dirty ratios. For others don't know why they are setting background ratio close enough to dirty ratio. Someone must set background ratio equal to dirty ratio, but no one seems to notice or complain that it's then silently halved under the hood.. Signed-off-by: Wu Fengguang --- mm/page-writeback.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- linux-next.orig/mm/page-writeback.c 2010-11-15 13:12:50.000000000 +0800 +++ linux-next/mm/page-writeback.c 2010-11-15 13:13:42.000000000 +0800 @@ -403,8 +403,15 @@ void global_dirty_limits(unsigned long * else background = (dirty_background_ratio * available_memory) / 100; - if (background >= dirty) - background = dirty / 2; + /* + * Ensure at least 1/4 gap between background and dirty thresholds, so + * that when dirty throttling starts at (background + dirty)/2, it's at + * the entrance of bdi soft throttle threshold, so as to avoid being + * hard throttled. + */ + if (background > dirty - dirty * 2 / BDI_SOFT_DIRTY_LIMIT) + background = dirty - dirty * 2 / BDI_SOFT_DIRTY_LIMIT; + tsk = current; if (tsk->flags & PF_LESS_THROTTLE || rt_task(tsk)) { background += background / 4; -- 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 policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: email@kvack.org