From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758203Ab0LMPQo (ORCPT ); Mon, 13 Dec 2010 10:16:44 -0500 Received: from mga02.intel.com ([134.134.136.20]:36467 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752131Ab0LMPIs (ORCPT ); Mon, 13 Dec 2010 10:08:48 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,336,1288594800"; d="scan'208";a="686646806" Message-Id: <20101213150327.090779080@intel.com> User-Agent: quilt/0.48-1 Date: Mon, 13 Dec 2010 22:46:52 +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 06/35] writeback: consolidate variable names in balance_dirty_pages() References: <20101213144646.341970461@intel.com> Content-Disposition: inline; filename=writeback-cleanup-name-merge.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lots of lengthy tests.. Let's compact the names nr_dirty = NR_FILE_DIRTY + NR_WRITEBACK + NR_UNSTABLE_NFS balance_dirty_pages() only cares about the above dirty sum except in one place -- on starting background writeback. Signed-off-by: Wu Fengguang --- mm/page-writeback.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) --- linux-next.orig/mm/page-writeback.c 2010-12-13 21:46:12.000000000 +0800 +++ linux-next/mm/page-writeback.c 2010-12-13 21:46:12.000000000 +0800 @@ -502,8 +502,9 @@ unsigned long bdi_dirty_limit(struct bac static void balance_dirty_pages(struct address_space *mapping, unsigned long pages_dirtied) { - long nr_reclaimable, bdi_nr_reclaimable; - long nr_writeback, bdi_nr_writeback; + long nr_reclaimable; + long nr_dirty; + long bdi_dirty; /* = file_dirty + writeback + unstable_nfs */ unsigned long background_thresh; unsigned long dirty_thresh; unsigned long bdi_thresh; @@ -521,7 +522,7 @@ static void balance_dirty_pages(struct a */ nr_reclaimable = global_page_state(NR_FILE_DIRTY) + global_page_state(NR_UNSTABLE_NFS); - nr_writeback = global_page_state(NR_WRITEBACK); + nr_dirty = nr_reclaimable + global_page_state(NR_WRITEBACK); global_dirty_limits(&background_thresh, &dirty_thresh); @@ -530,12 +531,10 @@ static void balance_dirty_pages(struct a * catch-up. This avoids (excessively) small writeouts * when the bdi limits are ramping up. */ - if (nr_reclaimable + nr_writeback <= - (background_thresh + dirty_thresh) / 2) + if (nr_dirty <= (background_thresh + dirty_thresh) / 2) break; - bdi_thresh = bdi_dirty_limit(bdi, dirty_thresh, - nr_reclaimable + nr_writeback); + bdi_thresh = bdi_dirty_limit(bdi, dirty_thresh, nr_dirty); bdi_thresh = task_dirty_limit(current, bdi_thresh); /* @@ -549,21 +548,21 @@ static void balance_dirty_pages(struct a * deltas. */ if (bdi_thresh < 2*bdi_stat_error(bdi)) { - bdi_nr_reclaimable = bdi_stat_sum(bdi, BDI_RECLAIMABLE); - bdi_nr_writeback = bdi_stat_sum(bdi, BDI_WRITEBACK); + bdi_dirty = bdi_stat_sum(bdi, BDI_RECLAIMABLE) + + bdi_stat_sum(bdi, BDI_WRITEBACK); } else { - bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE); - bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK); + bdi_dirty = bdi_stat(bdi, BDI_RECLAIMABLE) + + bdi_stat(bdi, BDI_WRITEBACK); } - if (bdi_nr_reclaimable + bdi_nr_writeback >= bdi_thresh) { + if (bdi_dirty >= bdi_thresh) { pause = MAX_PAUSE; goto pause; } bw = 100 << 20; /* use static 100MB/s for the moment */ - bw = bw * (bdi_thresh - (bdi_nr_reclaimable + bdi_nr_writeback)); + bw = bw * (bdi_thresh - bdi_dirty); do_div(bw, bdi_thresh / TASK_SOFT_DIRTY_LIMIT + 1); pause = HZ * (pages_dirtied << PAGE_CACHE_SHIFT) / (bw + 1); @@ -579,9 +578,8 @@ pause: * bdi or process from holding back light ones; The latter is * the last resort safeguard. */ - dirty_exceeded = - (bdi_nr_reclaimable + bdi_nr_writeback > bdi_thresh) - || (nr_reclaimable + nr_writeback > dirty_thresh); + dirty_exceeded = (bdi_dirty > bdi_thresh) || + (nr_dirty > dirty_thresh); if (!dirty_exceeded) break;