From patchwork Tue Apr 9 21:49:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Srivatsa S. Bhat" X-Patchwork-Id: 2417771 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2315F3FD8C for ; Tue, 9 Apr 2013 21:52:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936687Ab3DIVv4 (ORCPT ); Tue, 9 Apr 2013 17:51:56 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:41874 "EHLO e28smtp02.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935623Ab3DIVvz (ORCPT ); Tue, 9 Apr 2013 17:51:55 -0400 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Apr 2013 03:16:51 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 10 Apr 2013 03:16:50 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id E1B633940058; Wed, 10 Apr 2013 03:21:50 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r39LplMU7406004; Wed, 10 Apr 2013 03:21:47 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r39LpltK005882; Wed, 10 Apr 2013 07:51:50 +1000 Received: from srivatsabhat.in.ibm.com ([9.79.251.39]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r39Lpjho005719; Wed, 10 Apr 2013 07:51:45 +1000 From: "Srivatsa S. Bhat" Subject: [RFC PATCH v2 15/15] mm: Print memory region statistics to understand the buddy allocator behavior To: akpm@linux-foundation.org, mgorman@suse.de, matthew.garrett@nebula.com, dave@sr71.net, rientjes@google.com, riel@redhat.com, arjan@linux.intel.com, srinivas.pandruvada@linux.intel.com, maxime.coquelin@stericsson.com, loic.pallardy@stericsson.com, kamezawa.hiroyu@jp.fujitsu.com, lenb@kernel.org, rjw@sisk.pl Cc: gargankita@gmail.com, paulmck@linux.vnet.ibm.com, amit.kachhap@linaro.org, svaidy@linux.vnet.ibm.com, andi@firstfloor.org, wujianguo@huawei.com, kmpark@infradead.org, thomas.abraham@linaro.org, santosh.shilimkar@ti.com, srivatsa.bhat@linux.vnet.ibm.com, linux-pm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Wed, 10 Apr 2013 03:19:15 +0530 Message-ID: <20130409214911.4500.76868.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130409214443.4500.44168.stgit@srivatsabhat.in.ibm.com> References: <20130409214443.4500.44168.stgit@srivatsabhat.in.ibm.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13040921-5816-0000-0000-0000077BC8BA Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org In order to observe the behavior of the region-aware buddy allocator, modify vmstat.c to also print memory region related statistics. In particular, enable memory region-related info in /proc/zoneinfo and /proc/buddyinfo, since they would help us to atleast (roughly) observe how the new buddy allocator is behaving. For now, the region statistics correspond to the zone memory regions and not the (absolute) node memory regions, and some of the statistics (especially the no. of present pages) might not be very accurate. But since we account for and print the free page statistics for every zone memory region accurately, we should be able to observe the new page allocator behavior to a reasonable degree of accuracy. Signed-off-by: Srivatsa S. Bhat --- mm/vmstat.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/mm/vmstat.c b/mm/vmstat.c index 63e12f0..1a90475 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -825,11 +825,28 @@ const char * const vmstat_text[] = { static void frag_show_print(struct seq_file *m, pg_data_t *pgdat, struct zone *zone) { - int order; + int i, order, t; + struct free_area *area; - seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name); - for (order = 0; order < MAX_ORDER; ++order) - seq_printf(m, "%6lu ", zone->free_area[order].nr_free); + seq_printf(m, "Node %d, zone %8s \n", pgdat->node_id, zone->name); + + for (i = 0; i < zone->nr_zone_regions; i++) { + + seq_printf(m, "\t\t Region %d ", i); + + for (order = 0; order < MAX_ORDER; ++order) { + unsigned long nr_free = 0; + + area = &zone->free_area[order]; + + for (t = 0; t < MIGRATE_TYPES; t++) { + nr_free += + area->free_list[t].mr_list[i].nr_free; + } + seq_printf(m, "%6lu ", nr_free); + } + seq_putc(m, '\n'); + } seq_putc(m, '\n'); } @@ -1016,6 +1033,15 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, zone->present_pages, zone->managed_pages); + seq_printf(m, "\n\nPer-region page stats\t present\t free\n\n"); + for (i = 0; i < zone->nr_zone_regions; i++) { + struct zone_mem_region *region; + + region = &zone->zone_regions[i]; + seq_printf(m, "\tRegion %d \t %6lu \t %6lu\n", i, + region->present_pages, region->nr_free); + } + for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) seq_printf(m, "\n %-12s %lu", vmstat_text[i], zone_page_state(zone, i));