From patchwork Fri May 27 12:31:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankita Garg X-Patchwork-Id: 823942 Received: from bombadil.infradead.org (173-166-109-252-newengland.hfc.comcastbusiness.net [173.166.109.252]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4RChSPd007723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 27 May 2011 12:43:50 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QPwDc-0006Dw-Ln; Fri, 27 May 2011 12:32:44 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QPwDZ-0002OM-Jy; Fri, 27 May 2011 12:32:41 +0000 Received: from e28smtp03.in.ibm.com ([122.248.162.3]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QPwD0-0002JX-TA for linux-arm-kernel@lists.infradead.org; Fri, 27 May 2011 12:32:09 +0000 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by e28smtp03.in.ibm.com (8.14.4/8.13.1) with ESMTP id p4RCVvk9009937 for ; Fri, 27 May 2011 18:01:57 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p4RCVvrw4501672 for ; Fri, 27 May 2011 18:01:57 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p4RCVqJS003665 for ; Fri, 27 May 2011 22:31:54 +1000 Received: from rollercoaster.ibm.com ([9.124.35.203]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p4RCVqo6003574; Fri, 27 May 2011 22:31:52 +1000 From: Ankita Garg To: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-pm@lists.linux-foundation.org Subject: [PATCH 07/10] mm: Modify vmstat Date: Fri, 27 May 2011 18:01:35 +0530 Message-Id: <1306499498-14263-8-git-send-email-ankita@in.ibm.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1306499498-14263-1-git-send-email-ankita@in.ibm.com> References: <1306499498-14263-1-git-send-email-ankita@in.ibm.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110527_083207_551076_9813E4B2 X-CRM114-Status: GOOD ( 15.11 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [122.248.162.3 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: svaidy@linux.vnet.ibm.com, thomas.abraham@linaro.org, ankita@in.ibm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 27 May 2011 12:43:50 +0000 (UTC) Change the way vmstats are collected. Since the zones are now present inside regions, scan through all the regions to obtain zone specific statistics. Signed-off-by: Ankita Garg --- include/linux/vmstat.h | 22 +++++++++++++++------- mm/vmstat.c | 48 ++++++++++++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 2b3831b..296b9ad 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -211,20 +211,28 @@ extern unsigned long zone_reclaimable_pages(struct zone *zone); static inline unsigned long node_page_state(int node, enum zone_stat_item item) { - struct zone *zones = NODE_DATA(node)->node_zones; + int i; + unsigned long page_state = 0; + + for_each_mem_region_in_nid(i, node) { + mr_data_t *mrdat = &(NODE_DATA(node)->mem_regions[i]); + struct zone *zones = mrdat->zones; + + page_state = - return #ifdef CONFIG_ZONE_DMA - zone_page_state(&zones[ZONE_DMA], item) + + zone_page_state(&zones[ZONE_DMA], item) + #endif #ifdef CONFIG_ZONE_DMA32 - zone_page_state(&zones[ZONE_DMA32], item) + + zone_page_state(&zones[ZONE_DMA32], item) + #endif #ifdef CONFIG_HIGHMEM - zone_page_state(&zones[ZONE_HIGHMEM], item) + + zone_page_state(&zones[ZONE_HIGHMEM], item) + #endif - zone_page_state(&zones[ZONE_NORMAL], item) + - zone_page_state(&zones[ZONE_MOVABLE], item); + zone_page_state(&zones[ZONE_NORMAL], item) + + zone_page_state(&zones[ZONE_MOVABLE], item); + } + return page_state; } extern void zone_statistics(struct zone *, struct zone *, gfp_t gfp); diff --git a/mm/vmstat.c b/mm/vmstat.c index 897ea9e..542f8b6 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -191,17 +191,21 @@ void set_pgdat_percpu_threshold(pg_data_t *pgdat, struct zone *zone; int cpu; int threshold; - int i; + int i, p; for (i = 0; i < pgdat->nr_zones; i++) { - zone = &pgdat->node_zones[i]; - if (!zone->percpu_drift_mark) - continue; - - threshold = (*calculate_pressure)(zone); - for_each_possible_cpu(cpu) - per_cpu_ptr(zone->pageset, cpu)->stat_threshold - = threshold; + for_each_mem_region_in_nid(p, pgdat->node_id) { + mem_region_t *mem_region = &pgdat->mem_regions[p]; + struct zone *zone = mem_region->zones + i; + + if (!zone->percpu_drift_mark) + continue; + + threshold = (*calculate_pressure)(zone); + for_each_possible_cpu(cpu) + per_cpu_ptr(zone->pageset, cpu)->stat_threshold + = threshold; + } } } @@ -642,19 +646,23 @@ static void frag_stop(struct seq_file *m, void *arg) /* Walk all the zones in a node and print using a callback */ static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat, - void (*print)(struct seq_file *m, pg_data_t *, struct zone *)) + void (*print)(struct seq_file *m, pg_data_t *, + mem_region_t *, struct zone *)) { - struct zone *zone; - struct zone *node_zones = pgdat->node_zones; unsigned long flags; - - for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) { - if (!populated_zone(zone)) - continue; - - spin_lock_irqsave(&zone->lock, flags); - print(m, pgdat, zone); - spin_unlock_irqrestore(&zone->lock, flags); + int i, j; + + for (i = 0; i < MAX_NR_ZONES; ++i) { + for_each_mem_region_in_nid(j, pgdat->node_id) { + mem_region_t *mem_region = &pgdat->mem_regions[j]; + struct zone *zone = mem_region->zones + i; + if (!populated_zone(zone)) + continue; + + spin_lock_irqsave(&zone->lock, flags); + print(m, pgdat, mem_region, zone); + spin_unlock_irqrestore(&zone->lock, flags); + } } } #endif