Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753790AbbFDNKN (ORCPT ); Thu, 4 Jun 2015 09:10:13 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:10350 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932142AbbFDNKL (ORCPT ); Thu, 4 Jun 2015 09:10:11 -0400 Message-ID: <55704C79.5060608@huawei.com> Date: Thu, 4 Jun 2015 21:02:49 +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 08/12] mm: use mirrorable to switch allocate mirrored memory 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: 1828 Lines: 63 Add a new interface in path /proc/sys/vm/mirrorable. When set to 1, it means we should allocate mirrored memory for both user and kernel processes. Signed-off-by: Xishi Qiu --- include/linux/mmzone.h | 1 + kernel/sysctl.c | 9 +++++++++ mm/page_alloc.c | 1 + 3 files changed, 11 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index f82e3ae..20888dd 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -85,6 +85,7 @@ struct mirror_info { }; extern struct mirror_info mirror_info; +extern int sysctl_mirrorable; # define is_migrate_mirror(migratetype) unlikely((migratetype) == MIGRATE_MIRROR) #else # define is_migrate_mirror(migratetype) false diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 2082b1a..dc2625e 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1514,6 +1514,15 @@ static struct ctl_table vm_table[] = { .extra2 = &one, }, #endif +#ifdef CONFIG_MEMORY_MIRROR + { + .procname = "mirrorable", + .data = &sysctl_mirrorable, + .maxlen = sizeof(sysctl_mirrorable), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + }, +#endif { .procname = "user_reserve_kbytes", .data = &sysctl_user_reserve_kbytes, diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 249a8f6..63b90ca 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -212,6 +212,7 @@ int user_min_free_kbytes = -1; #ifdef CONFIG_MEMORY_MIRROR struct mirror_info mirror_info; +int sysctl_mirrorable = 0; #endif static unsigned long __meminitdata nr_kernel_pages; -- 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/