Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932256AbbBLHbx (ORCPT ); Thu, 12 Feb 2015 02:31:53 -0500 Received: from LGEMRELSE7Q.lge.com ([156.147.1.151]:42108 "EHLO lgemrelse7q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755206AbbBLHaO (ORCPT ); Thu, 12 Feb 2015 02:30:14 -0500 X-Original-SENDERIP: 10.177.222.153 X-Original-MAILFROM: iamjoonsoo.kim@lge.com From: Joonsoo Kim To: Andrew Morton Cc: Rik van Riel , Johannes Weiner , Mel Gorman , Laura Abbott , Minchan Kim , Heesub Shin , Marek Szyprowski , Michal Nazarewicz , "Aneesh Kumar K.V" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hui Zhu , Gioh Kim , Bartlomiej Zolnierkiewicz , Ritesh Harjani , Vlastimil Babka , Joonsoo Kim Subject: [RFC 14/16] mm/cma: print stealed page count Date: Thu, 12 Feb 2015 16:32:18 +0900 Message-Id: <1423726340-4084-15-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1423726340-4084-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1423726340-4084-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2284 Lines: 84 Reserved pages for CMA could be on different zone. To figure out memory map correctly, per zone number of stealed pages for CMA would be needed. Signed-off-by: Joonsoo Kim --- mm/cma.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/mm/cma.c b/mm/cma.c index 267fa14..b165c1a 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -40,6 +40,8 @@ struct cma cma_areas[MAX_CMA_AREAS]; unsigned cma_area_count; static DEFINE_MUTEX(cma_mutex); +static unsigned long __initdata stealed_pages[MAX_NUMNODES][MAX_NR_ZONES]; + unsigned long cma_total_pages(unsigned long node_start_pfn, unsigned long node_end_pfn) { @@ -98,6 +100,7 @@ static int __init cma_activate_area(struct cma *cma) unsigned long base_pfn = cma->base_pfn, pfn = base_pfn; unsigned i = cma->count >> pageblock_order; int nid; + int zone_index; cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL); @@ -125,6 +128,8 @@ static int __init cma_activate_area(struct cma *cma) if (page_to_nid(pfn_to_page(pfn)) != nid) goto err; } + zone_index = zone_idx(page_zone(pfn_to_page(base_pfn))); + stealed_pages[nid][zone_index] += pageblock_nr_pages; init_cma_reserved_pageblock(base_pfn); } while (--i); @@ -145,7 +150,9 @@ err: static int __init cma_init_reserved_areas(void) { - int i; + int i, j; + pg_data_t *pgdat; + struct zone *zone; for (i = 0; i < cma_area_count; i++) { int ret = cma_activate_area(&cma_areas[i]); @@ -154,6 +161,25 @@ static int __init cma_init_reserved_areas(void) return ret; } + for (i = 0; i < MAX_NUMNODES; i++) { + for (j = 0; j < MAX_NR_ZONES; j++) { + if (stealed_pages[i][j]) + goto print; + } + continue; + +print: + pgdat = NODE_DATA(i); + for (j = 0; j < MAX_NR_ZONES; j++) { + if (!stealed_pages[i][j]) + continue; + + zone = pgdat->node_zones + j; + pr_info("Steal %lu pages from %s\n", + stealed_pages[i][j], zone->name); + } + } + return 0; } core_initcall(cma_init_reserved_areas); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/