From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758137Ab0LMPOQ (ORCPT ); Mon, 13 Dec 2010 10:14:16 -0500 Received: from mga02.intel.com ([134.134.136.20]:60850 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754535Ab0LMPIu (ORCPT ); Mon, 13 Dec 2010 10:08:50 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,336,1288594800"; d="scan'208";a="583219906" Message-Id: <20101213150328.526742344@intel.com> User-Agent: quilt/0.48-1 Date: Mon, 13 Dec 2010 22:47:04 +0800 From: Wu Fengguang To: Andrew Morton CC: Jan Kara , Wu Fengguang CC: Christoph Hellwig CC: Trond Myklebust CC: Dave Chinner CC: "Theodore Ts'o" CC: Chris Mason CC: Peter Zijlstra CC: Mel Gorman CC: Rik van Riel CC: KOSAKI Motohiro CC: Greg Thelen CC: Minchan Kim Cc: linux-mm Cc: Cc: LKML Subject: [PATCH 18/35] writeback: start background writeback earlier References: <20101213144646.341970461@intel.com> Content-Disposition: inline; filename=writeback-kick-background-early.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's possible for some one to suddenly eat lots of memory, leading to sudden drop of global dirty limit. So a dirtier task may get hard throttled immediately without some previous balance_dirty_pages() call to invoke background writeback. In this case we need to check for background writeback earlier in the loop to avoid stucking the application for very long time. This was not a problem before the IO-less balance_dirty_pages() because it will try to write something and then break out of the loop regardless of the global limit. Another scheme this check will help is, the dirty limit is too close to the background threshold, so that someone manages to jump directly into the pause threshold (background+dirty)/2. Signed-off-by: Wu Fengguang --- mm/page-writeback.c | 3 +++ 1 file changed, 3 insertions(+) --- linux-next.orig/mm/page-writeback.c 2010-12-13 21:46:16.000000000 +0800 +++ linux-next/mm/page-writeback.c 2010-12-13 21:46:17.000000000 +0800 @@ -748,6 +748,9 @@ static void balance_dirty_pages(struct a bdi_stat(bdi, BDI_WRITEBACK); } + if (unlikely(!writeback_in_progress(bdi))) + bdi_start_background_writeback(bdi); + bdi_update_bandwidth(bdi, start_time, bdi_dirty, bdi_thresh); /* From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: [PATCH 18/35] writeback: start background writeback earlier Date: Mon, 13 Dec 2010 22:47:04 +0800 Message-ID: <20101213150328.526742344@intel.com> References: <20101213144646.341970461@intel.com> Cc: Jan Kara , Wu Fengguang To: Andrew Morton Return-path: CC: Christoph Hellwig CC: Trond Myklebust CC: Dave Chinner CC: Theodore Ts'o CC: Chris Mason CC: Peter Zijlstra CC: Mel Gorman CC: Rik van Riel CC: KOSAKI Motohiro CC: Greg Thelen CC: Minchan Kim Cc: linux-mm Cc: Cc: LKML Content-Disposition: inline; filename=writeback-kick-background-early.patch Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org It's possible for some one to suddenly eat lots of memory, leading to sudden drop of global dirty limit. So a dirtier task may get hard throttled immediately without some previous balance_dirty_pages() call to invoke background writeback. In this case we need to check for background writeback earlier in the loop to avoid stucking the application for very long time. This was not a problem before the IO-less balance_dirty_pages() because it will try to write something and then break out of the loop regardless of the global limit. Another scheme this check will help is, the dirty limit is too close to the background threshold, so that someone manages to jump directly into the pause threshold (background+dirty)/2. Signed-off-by: Wu Fengguang --- mm/page-writeback.c | 3 +++ 1 file changed, 3 insertions(+) --- linux-next.orig/mm/page-writeback.c 2010-12-13 21:46:16.000000000 +0800 +++ linux-next/mm/page-writeback.c 2010-12-13 21:46:17.000000000 +0800 @@ -748,6 +748,9 @@ static void balance_dirty_pages(struct a bdi_stat(bdi, BDI_WRITEBACK); } + if (unlikely(!writeback_in_progress(bdi))) + bdi_start_background_writeback(bdi); + bdi_update_bandwidth(bdi, start_time, bdi_dirty, bdi_thresh); /* -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: [PATCH 18/35] writeback: start background writeback earlier Date: Mon, 13 Dec 2010 22:47:04 +0800 Message-ID: <20101213150328.526742344@intel.com> References: <20101213144646.341970461@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 1PSA2b-0002MM-3L for glkm-linux-mm-2@m.gmane.org; Mon, 13 Dec 2010 16:10:17 +0100 Received: from mail202.messagelabs.com (mail202.messagelabs.com [216.82.254.227]) by kanga.kvack.org (Postfix) with SMTP id DB9756B00AE for ; Mon, 13 Dec 2010 10:08:52 -0500 (EST) Content-Disposition: inline; filename=writeback-kick-background-early.patch Sender: owner-linux-mm@kvack.org To: Andrew Morton Cc: Jan Kara , Wu Fengguang , Christoph Hellwig , Trond Myklebust , Dave Chinner , Theodore Ts'o , Chris Mason , Peter Zijlstra , Mel Gorman , Rik van Riel , KOSAKI Motohiro , Greg Thelen , Minchan Kim , linux-mm , linux-fsdevel@vger.kernel.org, LKML List-Id: linux-mm.kvack.org It's possible for some one to suddenly eat lots of memory, leading to sudden drop of global dirty limit. So a dirtier task may get hard throttled immediately without some previous balance_dirty_pages() call to invoke background writeback. In this case we need to check for background writeback earlier in the loop to avoid stucking the application for very long time. This was not a problem before the IO-less balance_dirty_pages() because it will try to write something and then break out of the loop regardless of the global limit. Another scheme this check will help is, the dirty limit is too close to the background threshold, so that someone manages to jump directly into the pause threshold (background+dirty)/2. Signed-off-by: Wu Fengguang --- mm/page-writeback.c | 3 +++ 1 file changed, 3 insertions(+) --- linux-next.orig/mm/page-writeback.c 2010-12-13 21:46:16.000000000 +0800 +++ linux-next/mm/page-writeback.c 2010-12-13 21:46:17.000000000 +0800 @@ -748,6 +748,9 @@ static void balance_dirty_pages(struct a bdi_stat(bdi, BDI_WRITEBACK); } + if (unlikely(!writeback_in_progress(bdi))) + bdi_start_background_writeback(bdi); + bdi_update_bandwidth(bdi, start_time, bdi_dirty, bdi_thresh); /* -- 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