Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932146AbbFDNCR (ORCPT ); Thu, 4 Jun 2015 09:02:17 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:63025 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753618AbbFDNCP (ORCPT ); Thu, 4 Jun 2015 09:02:15 -0400 Message-ID: <55704B8C.7080506@huawei.com> Date: Thu, 4 Jun 2015 20:58:52 +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: Xishi Qiu , Andrew Morton , , Yinghai Lu , "H. Peter Anvin" , Thomas Gleixner , , Xiexiuqi , Hanjun Guo , "Luck, Tony" CC: Linux MM , LKML Subject: [RFC PATCH 03/12] mm: introduce MIGRATE_MIRROR to manage the mirrored, pages References: <55704A7E.5030507@huawei.com> In-Reply-To: <55704A7E.5030507@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: 5952 Lines: 116 This patch introduces a new MIGRATE_TYPES called "MIGRATE_MIRROR", it is used to storage the mirrored pages list. When cat /proc/pagetypeinfo, you can see the count of free mirrored blocks. e.g. euler-linux:~ # cat /proc/pagetypeinfo Page block order: 9 Pages per block: 512 Free pages count per migrate type at order 0 1 2 3 4 5 6 7 8 9 10 Node 0, zone DMA, type Unmovable 1 1 0 0 2 1 1 0 1 0 0 Node 0, zone DMA, type Reclaimable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type Movable 0 0 0 0 0 0 0 0 0 0 3 Node 0, zone DMA, type Mirror 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA, type Reserve 0 0 0 0 0 0 0 0 0 1 0 Node 0, zone DMA, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA32, type Unmovable 0 0 1 0 0 0 0 1 1 1 0 Node 0, zone DMA32, type Reclaimable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA32, type Movable 1 2 6 6 6 4 5 3 3 2 738 Node 0, zone DMA32, type Mirror 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone DMA32, type Reserve 0 0 0 0 0 0 0 0 0 0 1 Node 0, zone DMA32, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type Unmovable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type Reclaimable 0 0 0 0 0 0 0 0 0 0 0 Node 0, zone Normal, type Movable 0 0 1 1 0 0 0 2 1 0 4254 Node 0, zone Normal, type Mirror 148 104 63 70 26 11 2 2 1 1 973 Node 0, zone Normal, type Reserve 0 0 0 0 0 0 0 0 0 0 1 Node 0, zone Normal, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Number of blocks type Unmovable Reclaimable Movable Mirror Reserve Isolate Node 0, zone DMA 1 0 6 0 1 0 Node 0, zone DMA32 2 0 1525 0 1 0 Node 0, zone Normal 0 0 8702 2048 2 0 Page block order: 9 Pages per block: 512 Free pages count per migrate type at order 0 1 2 3 4 5 6 7 8 9 10 Node 1, zone Normal, type Unmovable 0 0 0 0 0 0 0 0 0 0 0 Node 1, zone Normal, type Reclaimable 0 0 0 0 0 0 0 0 0 0 0 Node 1, zone Normal, type Movable 2 2 1 1 2 1 2 2 2 3 3996 Node 1, zone Normal, type Mirror 68 94 57 6 8 1 0 0 3 1 2003 Node 1, zone Normal, type Reserve 0 0 0 0 0 0 0 0 0 0 1 Node 1, zone Normal, type Isolate 0 0 0 0 0 0 0 0 0 0 0 Number of blocks type Unmovable Reclaimable Movable Mirror Reserve Isolate Node 1, zone Normal 0 0 8190 4096 2 0 Signed-off-by: Xishi Qiu --- include/linux/mmzone.h | 6 ++++++ mm/page_alloc.c | 3 +++ mm/vmstat.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 1fae07b..b444335 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 @@ -82,6 +85,9 @@ struct mirror_info { }; extern struct mirror_info mirror_info; +# define is_migrate_mirror(migratetype) unlikely((migratetype) == MIGRATE_MIRROR) +#else +# define is_migrate_mirror(migratetype) false #endif #define for_each_migratetype_order(order, type) \ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 41a95a7..3b2ff46 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3245,6 +3245,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/