Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753053AbbF0CYp (ORCPT ); Fri, 26 Jun 2015 22:24:45 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:53480 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751762AbbF0CYj (ORCPT ); Fri, 26 Jun 2015 22:24:39 -0400 Message-ID: <558E0948.2010104@huawei.com> Date: Sat, 27 Jun 2015 10:24:08 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Andrew Morton , "H. Peter Anvin" , Ingo Molnar , "Luck, Tony" , Hanjun Guo , Xiexiuqi , , Kamezawa Hiroyuki , Dave Hansen , Naoya Horiguchi , Vlastimil Babka , Mel Gorman CC: Xishi Qiu , Linux MM , LKML Subject: [RFC v2 PATCH 2/8] mm: introduce MIGRATE_MIRROR to manage the mirrored pages References: <558E084A.60900@huawei.com> In-Reply-To: <558E084A.60900@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2184 Lines: 75 This patch introduces a new migratetype called "MIGRATE_MIRROR", it is used to allocate mirrored pages. When cat /proc/pagetypeinfo, you can see the count of free mirrored blocks. Signed-off-by: Xishi Qiu --- include/linux/mmzone.h | 9 +++++++++ mm/page_alloc.c | 3 +++ mm/vmstat.c | 3 +++ 3 files changed, 15 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 54d74f6..54e891a 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -39,6 +39,9 @@ enum { MIGRATE_UNMOVABLE, MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE, +#ifdef CONFIG_MEMORY_MIRROR + MIGRATE_MIRROR, +#endif MIGRATE_PCPTYPES, /* the number of types on the pcp lists */ MIGRATE_RESERVE = MIGRATE_PCPTYPES, #ifdef CONFIG_CMA @@ -69,6 +72,12 @@ enum { # define is_migrate_cma(migratetype) false #endif +#ifdef CONFIG_MEMORY_MIRROR +# define is_migrate_mirror(migratetype) unlikely((migratetype) == MIGRATE_MIRROR) +#else +# define is_migrate_mirror(migratetype) false +#endif + #define for_each_migratetype_order(order, type) \ for (order = 0; order < MAX_ORDER; order++) \ for (type = 0; type < MIGRATE_TYPES; type++) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ebffa0e..6e4d79f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3216,6 +3216,9 @@ static void show_migration_types(unsigned char type) [MIGRATE_UNMOVABLE] = 'U', [MIGRATE_RECLAIMABLE] = 'E', [MIGRATE_MOVABLE] = 'M', +#ifdef CONFIG_MEMORY_MIRROR + [MIGRATE_MIRROR] = 'O', +#endif [MIGRATE_RESERVE] = 'R', #ifdef CONFIG_CMA [MIGRATE_CMA] = 'C', diff --git a/mm/vmstat.c b/mm/vmstat.c index 4f5cd97..d0323e0 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -901,6 +901,9 @@ static char * const migratetype_names[MIGRATE_TYPES] = { "Unmovable", "Reclaimable", "Movable", +#ifdef CONFIG_MEMORY_MIRROR + "Mirror", +#endif "Reserve", #ifdef CONFIG_CMA "CMA", -- 2.0.0 -- 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/