Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756128AbcJGGhf (ORCPT ); Fri, 7 Oct 2016 02:37:35 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35348 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085AbcJGGhZ (ORCPT ); Fri, 7 Oct 2016 02:37:25 -0400 From: "Aneesh Kumar K.V" To: Reza Arbab , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Rob Herring , Frank Rowand , Andrew Morton Cc: Bharata B Rao , Nathan Fontenot , Stewart Smith , Alistair Popple , Balbir Singh , Tang Chen , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v4 4/5] mm: make processing of movable_node arch-specific In-Reply-To: <1475778995-1420-5-git-send-email-arbab@linux.vnet.ibm.com> References: <1475778995-1420-1-git-send-email-arbab@linux.vnet.ibm.com> <1475778995-1420-5-git-send-email-arbab@linux.vnet.ibm.com> Date: Fri, 07 Oct 2016 12:07:11 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16100706-0012-0000-0000-000010D4DDCC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005866; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00765361; UDB=6.00365706; IPR=6.00541209; BA=6.00004791; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012902; XFM=3.00000011; UTC=2016-10-07 06:37:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16100706-0013-0000-0000-0000461C0B8E Message-Id: <87zimgmzqg.fsf@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-07_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610070117 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4595 Lines: 123 Reza Arbab writes: > Currently, CONFIG_MOVABLE_NODE depends on X86_64. In preparation to > enable it for other arches, we need to factor a detail which is unique > to x86 out of the generic mm code. > > Specifically, as documented in kernel-parameters.txt, the use of > "movable_node" should remain restricted to x86: > > movable_node [KNL,X86] Boot-time switch to enable the effects > of CONFIG_MOVABLE_NODE=y. See mm/Kconfig for details. > > This option tells x86 to find movable nodes identified by the ACPI SRAT. > On other arches, it would have no benefit, only the undesired side > effect of setting bottom-up memblock allocation. > > Since #ifdef CONFIG_MOVABLE_NODE will no longer be enough to restrict > this option to x86, move it to an arch-specific compilation unit > instead. Reviewed-by: Aneesh Kumar K.V > > Signed-off-by: Reza Arbab > --- > arch/x86/mm/numa.c | 35 ++++++++++++++++++++++++++++++++++- > mm/memory_hotplug.c | 31 ------------------------------- > 2 files changed, 34 insertions(+), 32 deletions(-) > > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c > index fb68210..e95cab4 100644 > --- a/arch/x86/mm/numa.c > +++ b/arch/x86/mm/numa.c > @@ -887,6 +887,38 @@ EXPORT_SYMBOL(cpumask_of_node); > #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ > > #ifdef CONFIG_MEMORY_HOTPLUG > + > +static int __init cmdline_parse_movable_node(char *p) > +{ > +#ifdef CONFIG_MOVABLE_NODE > + /* > + * Memory used by the kernel cannot be hot-removed because Linux > + * cannot migrate the kernel pages. When memory hotplug is > + * enabled, we should prevent memblock from allocating memory > + * for the kernel. > + * > + * ACPI SRAT records all hotpluggable memory ranges. But before > + * SRAT is parsed, we don't know about it. > + * > + * The kernel image is loaded into memory at very early time. We > + * cannot prevent this anyway. So on NUMA system, we set any > + * node the kernel resides in as un-hotpluggable. > + * > + * Since on modern servers, one node could have double-digit > + * gigabytes memory, we can assume the memory around the kernel > + * image is also un-hotpluggable. So before SRAT is parsed, just > + * allocate memory near the kernel image to try the best to keep > + * the kernel away from hotpluggable memory. > + */ > + memblock_set_bottom_up(true); > + movable_node_enabled = true; > +#else > + pr_warn("movable_node option not supported\n"); > +#endif > + return 0; > +} > +early_param("movable_node", cmdline_parse_movable_node); > + > int memory_add_physaddr_to_nid(u64 start) > { > struct numa_meminfo *mi = &numa_meminfo; > @@ -899,4 +931,5 @@ int memory_add_physaddr_to_nid(u64 start) > return nid; > } > EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); > -#endif > + > +#endif /* CONFIG_MEMORY_HOTPLUG */ > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 9d29ba0..79c709a 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1738,37 +1738,6 @@ static bool can_offline_normal(struct zone *zone, unsigned long nr_pages) > } > #endif /* CONFIG_MOVABLE_NODE */ > > -static int __init cmdline_parse_movable_node(char *p) > -{ > -#ifdef CONFIG_MOVABLE_NODE > - /* > - * Memory used by the kernel cannot be hot-removed because Linux > - * cannot migrate the kernel pages. When memory hotplug is > - * enabled, we should prevent memblock from allocating memory > - * for the kernel. > - * > - * ACPI SRAT records all hotpluggable memory ranges. But before > - * SRAT is parsed, we don't know about it. > - * > - * The kernel image is loaded into memory at very early time. We > - * cannot prevent this anyway. So on NUMA system, we set any > - * node the kernel resides in as un-hotpluggable. > - * > - * Since on modern servers, one node could have double-digit > - * gigabytes memory, we can assume the memory around the kernel > - * image is also un-hotpluggable. So before SRAT is parsed, just > - * allocate memory near the kernel image to try the best to keep > - * the kernel away from hotpluggable memory. > - */ > - memblock_set_bottom_up(true); > - movable_node_enabled = true; > -#else > - pr_warn("movable_node option not supported\n"); > -#endif > - return 0; > -} > -early_param("movable_node", cmdline_parse_movable_node); > - > /* check which state of node_states will be changed when offline memory */ > static void node_states_check_changes_offline(unsigned long nr_pages, > struct zone *zone, struct memory_notify *arg) > -- > 1.8.3.1