From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757719AbcHDLde (ORCPT ); Thu, 4 Aug 2016 07:33:34 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:8809 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932165AbcHDLdd (ORCPT ); Thu, 4 Aug 2016 07:33:33 -0400 Message-ID: <57A325CA.9050707@huawei.com> Date: Thu, 4 Aug 2016 19:23:54 +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: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Vlastimil Babka , Mel Gorman , Andrew Morton , Michal Hocko , David Rientjes , "Joonsoo Kim" , Taku Izumi , "'Kirill A . Shutemov'" , Kamezawa Hiroyuki CC: Linux MM , LKML Subject: [PATCH 1/3] mem-hotplug: introduce movablenode option Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.57A325D8.0197,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: fc5e36cd567e62d1068675e3948ba6a6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces a new boot option movablenode. To support memory hotplug, boot option "movable_node" is needed. And to support debug memory hotplug, boot option "movable_node" and "movablenode" are both needed. e.g. movable_node movablenode=1,2,4 It means node 1,2,4 will be set to movable nodes, the other nodes are unmovable nodes. Usually movable nodes are parsed from SRAT table which offered by BIOS, so this boot option is used for debug. Signed-off-by: Xishi Qiu --- Documentation/kernel-parameters.txt | 4 ++++ arch/x86/mm/srat.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 82b42c9..f8726f8 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -2319,6 +2319,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted. movable_node [KNL,X86] Boot-time switch to enable the effects of CONFIG_MOVABLE_NODE=y. See mm/Kconfig for details. + movablenode= [KNL,X86] Boot-time switch to set which node is + movable node. + Format: ,..., + MTD_Partition= [MTD] Format: ,,, diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index b5f8218..c4cd81a 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c @@ -157,6 +157,38 @@ static inline int save_add_info(void) {return 1;} static inline int save_add_info(void) {return 0;} #endif +static nodemask_t movablenode_mask; + +static void __init parse_movablenode_one(char *p) +{ + int node; + + get_option(&p, &node); + node_set(node, movablenode_mask); +} + +/* + * movablenode=,..., sets which node is movable + * node. + */ +static int __init parse_movablenode_opt(char *str) +{ +#ifdef CONFIG_MOVABLE_NODE + while (str) { + char *k = strchr(str, ','); + + if (k) + *k++ = 0; + parse_movablenode_one(str); + str = k; + } +#else + pr_warn("movable_node option not supported\n"); +#endif + return 0; +} +early_param("movablenode", parse_movablenode_opt); + /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ int __init acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) @@ -205,6 +237,10 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) max_possible_pfn = max(max_possible_pfn, PFN_UP(end - 1)); + if (node_isset(node, movablenode_mask) && memblock_mark_hotplug(start, ma->length)) + pr_warn("SRAT debug: Failed to mark hotplug range [mem %#010Lx-%#010Lx] in memblock\n", + (unsigned long long)start, (unsigned long long)end - 1); + return 0; out_err_bad_srat: bad_srat(); -- 1.8.3.1