From patchwork Fri Aug 30 12:39:34 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: 2851992 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 695EDC0AB5 for ; Fri, 30 Aug 2013 12:44:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0B3920495 for ; Fri, 30 Aug 2013 12:43:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8248120488 for ; Fri, 30 Aug 2013 12:43:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753245Ab3H3Mnn (ORCPT ); Fri, 30 Aug 2013 08:43:43 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:53722 "EHLO e9.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755627Ab3H3Mnl (ORCPT ); Fri, 30 Aug 2013 08:43:41 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 30 Aug 2013 08:43:40 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 30 Aug 2013 08:43:37 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 5C661C9003E; Fri, 30 Aug 2013 08:43:36 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp23032.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7UChaEo22478894; Fri, 30 Aug 2013 12:43:36 GMT Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r7UChUxc004792; Fri, 30 Aug 2013 08:43:36 -0400 Received: from srivatsabhat.in.ibm.com ([9.79.221.107]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r7UChLdh004333; Fri, 30 Aug 2013 08:43:23 -0400 From: "Srivatsa S. Bhat" Subject: [RFC PATCH v3 15/35] mm: Print memory region statistics to understand the buddy allocator behavior To: akpm@linux-foundation.org, mgorman@suse.de, hannes@cmpxchg.org, tony.luck@intel.com, matthew.garrett@nebula.com, dave@sr71.net, riel@redhat.com, arjan@linux.intel.com, srinivas.pandruvada@linux.intel.com, willy@linux.intel.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, isimatu.yasuaki@jp.fujitsu.com, santosh.shilimkar@ti.com, kosaki.motohiro@gmail.com, srivatsa.bhat@linux.vnet.ibm.com, linux-pm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Fri, 30 Aug 2013 18:09:34 +0530 Message-ID: <20130830123925.24352.708.stgit@srivatsabhat.in.ibm.com> In-Reply-To: <20130830123303.24352.18732.stgit@srivatsabhat.in.ibm.com> References: <20130830123303.24352.18732.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: 13083012-7182-0000-0000-00000840EAEF Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 0451957..4cba0da 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -827,11 +827,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 %6d ", 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'); } @@ -1018,6 +1035,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 %6d \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));