From nobody Thu Dec 18 16:17:11 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FCAF1B0F19; Wed, 9 Apr 2025 21:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744234425; cv=none; b=beWrhvunm2eR4DYaaaERa2N+e+HMlwat6NLvYC/er9eK924f1ASKTwdpYZFxG2eX64zWLszW2/vmbKO/8h5bGMXQEoxHtYYuEtj2Qj8J6xlFvL9mIBZ/SwOuQZVtYi0esG1KBdqOpE+6WD1FzVf6g75rbnLNIqhTkA8IJea95fU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744234425; c=relaxed/simple; bh=JdOn39X3FNu5JSNLrDhPgDNrzrELPoHZNHqg7GCpsxw=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=JILPjIUClmafkrUe46aozSUVwq7sZ2RHbx0reT3YeB9QmYe+zQjh9SAteIvdKKgi7vQgjsFbNwSSRrreX/VJ1FrtmUxUGoP4D+XVtETe9T/HAQpCLLNDPbLqrg8S0XOy13nGAUUBu58M4EOExi7+hsdit7D5fe+j/3OWP4eVJ0s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=M/PjdmfE; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Ja4+R7Su; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="M/PjdmfE"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Ja4+R7Su" Date: Wed, 09 Apr 2025 21:33:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1744234421; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EFCJPpeCHLUSc4T0Q6EKmhMjKKHTWdf3JcaA2i/2mqk=; b=M/PjdmfEbZ35OPvANYp3MxIuSA5g5jYgH9BVmZ6Ys8qLTUFh9G2FWiII2BEMHUeISiCSs4 FxalxZ1sMkOqkvkIX29Mvxn/0ELZEdnXprgO5uVJaACEJnUHj6alRYxYk1QI0TX1MDXG6t VijWP3AVOmio8CYFsY/h8VEhnmYSoKcXwuS894XL7RhMnPy3Sj85Q1SMEIfoG3wKkL+Gpp AwOgbSPfKrWcOapZ0wf26Hv4tu4Lw+VtxB/o8NxxXqVzCP2+C/mMaUoFsEy8xvnYuqcLEp S8MdfWOEXf7mTLECYUGvHC4aqSHwHO/tp4DgiXi35OCmRxE3Pyow2+CZAKkH6w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1744234421; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EFCJPpeCHLUSc4T0Q6EKmhMjKKHTWdf3JcaA2i/2mqk=; b=Ja4+R7Sur/ajGqPAgJq5gzH5M+h5Jymm623IEIcvRpzatwDPGicEal2hexuX+gfyETCbtd /bpO04N+RLPBuMDg== From: "tip-bot2 for Mike Rapoport (Microsoft)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/mm: Consolidate initmem_init() Cc: "Mike Rapoport (Microsoft)" , Ingo Molnar , Ard Biesheuvel , "H. Peter Anvin" , Kees Cook , Linus Torvalds , David Woodhouse , "Rafael J. Wysocki" , Len Brown , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250409122815.420041-1-rppt@kernel.org> References: <20250409122815.420041-1-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <174423442043.31282.15471928643459038021.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/mm branch of tip: Commit-ID: 35c3151a98a6e6f56552cff8dc7d59e8ef7aca50 Gitweb: https://git.kernel.org/tip/35c3151a98a6e6f56552cff8dc7d59e8e= f7aca50 Author: Mike Rapoport (Microsoft) AuthorDate: Wed, 09 Apr 2025 15:28:15 +03:00 Committer: Ingo Molnar CommitterDate: Wed, 09 Apr 2025 22:02:30 +02:00 x86/mm: Consolidate initmem_init() There are 4 wariants of initmem_init(), for 32 and 64 bits and for CONFIG_NUMA enabled and disabled. After commit bbeb69ce3013 ("x86/mm: Remove CONFIG_HIGHMEM64G support") NUMA is not supported on 32 bit kernels anymore, and arch/x86/mm/numa_32.c can be just deleted and setup_bootmem_allocator() with completely misleading name can be folded into initmem_init(). For 64 bits the NUMA variant calls x86_numa_init() and !NUMA variant sets all memory to node 0. The later can be split out into inline helper called x86_numa_init() and then both initmem_init() functions become the same. Split out memblock_set_node() from initmem_init() for !NUMA on 64 bit into x86_numa_init() helper and remove arch/x86/mm/numa_*.c that only contained initmem_init() variants for NUMA configs. Signed-off-by: Mike Rapoport (Microsoft) Signed-off-by: Ingo Molnar Cc: Ard Biesheuvel Cc: H. Peter Anvin Cc: Kees Cook Cc: Linus Torvalds Cc: David Woodhouse Cc: Rafael J. Wysocki Cc: Len Brown Link: https://lore.kernel.org/r/20250409122815.420041-1-rppt@kernel.org --- arch/x86/include/asm/page_32_types.h | 1 +- arch/x86/mm/Makefile | 2 +- arch/x86/mm/init_32.c | 7 +--- arch/x86/mm/init_64.c | 7 ++- arch/x86/mm/mm_internal.h | 4 ++- arch/x86/mm/numa.c | 3 +- arch/x86/mm/numa_32.c | 61 +--------------------------- arch/x86/mm/numa_64.c | 13 +------ arch/x86/mm/numa_internal.h | 10 +---- 9 files changed, 13 insertions(+), 95 deletions(-) delete mode 100644 arch/x86/mm/numa_32.c delete mode 100644 arch/x86/mm/numa_64.c delete mode 100644 arch/x86/mm/numa_internal.h diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/pa= ge_32_types.h index a9b62e0..623f1e9 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h @@ -73,7 +73,6 @@ extern unsigned int __VMALLOC_RESERVE; extern int sysctl_legacy_va_layout; =20 extern void find_low_pfn_range(void); -extern void setup_bootmem_allocator(void); =20 #endif /* !__ASSEMBLER__ */ =20 diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index 32035d5..1e72f06 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile @@ -52,7 +52,7 @@ obj-$(CONFIG_MMIOTRACE) +=3D mmiotrace.o mmiotrace-y :=3D kmmio.o pf_in.o mmio-mod.o obj-$(CONFIG_MMIOTRACE_TEST) +=3D testmmiotrace.o =20 -obj-$(CONFIG_NUMA) +=3D numa.o numa_$(BITS).o +obj-$(CONFIG_NUMA) +=3D numa.o obj-$(CONFIG_AMD_NUMA) +=3D amdtopology.o obj-$(CONFIG_ACPI_NUMA) +=3D srat.o =20 diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index ad662cc..d467f89 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -612,7 +612,6 @@ void __init find_low_pfn_range(void) highmem_pfn_init(); } =20 -#ifndef CONFIG_NUMA void __init initmem_init(void) { #ifdef CONFIG_HIGHMEM @@ -633,12 +632,6 @@ void __init initmem_init(void) printk(KERN_NOTICE "%ldMB LOWMEM available.\n", pages_to_mb(max_low_pfn)); =20 - setup_bootmem_allocator(); -} -#endif /* !CONFIG_NUMA */ - -void __init setup_bootmem_allocator(void) -{ printk(KERN_INFO " mapped low ram: 0 - %08lx\n", max_pfn_mapped< #include #include +#include =20 -#include "numa_internal.h" +#include "mm_internal.h" =20 int numa_off; =20 diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c deleted file mode 100644 index 65fda40..0000000 --- a/arch/x86/mm/numa_32.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Written by: Patricia Gaughen , IBM Corporation - * August 2002: added remote node KVA remap - Martin J. Bligh=20 - * - * Copyright (C) 2002, IBM Corp. - * - * All rights reserved. =20 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include - -#include "numa_internal.h" - -extern unsigned long highend_pfn, highstart_pfn; - -void __init initmem_init(void) -{ - x86_numa_init(); - -#ifdef CONFIG_HIGHMEM - highstart_pfn =3D highend_pfn =3D max_pfn; - if (max_pfn > max_low_pfn) - highstart_pfn =3D max_low_pfn; - printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", - pages_to_mb(highend_pfn - highstart_pfn)); - high_memory =3D (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; -#else - high_memory =3D (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; -#endif - printk(KERN_NOTICE "%ldMB LOWMEM available.\n", - pages_to_mb(max_low_pfn)); - printk(KERN_DEBUG "max_low_pfn =3D %lx, highstart_pfn =3D %lx\n", - max_low_pfn, highstart_pfn); - - printk(KERN_DEBUG "Low memory ends at vaddr %08lx\n", - (ulong) pfn_to_kaddr(max_low_pfn)); - - printk(KERN_DEBUG "High memory starts at vaddr %08lx\n", - (ulong) pfn_to_kaddr(highstart_pfn)); - - __vmalloc_start_set =3D true; - setup_bootmem_allocator(); -} diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c deleted file mode 100644 index 59d8016..0000000 --- a/arch/x86/mm/numa_64.c +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Generic VM initialization for x86-64 NUMA setups. - * Copyright 2002,2003 Andi Kleen, SuSE Labs. - */ -#include - -#include "numa_internal.h" - -void __init initmem_init(void) -{ - x86_numa_init(); -} diff --git a/arch/x86/mm/numa_internal.h b/arch/x86/mm/numa_internal.h deleted file mode 100644 index 11e1ff3..0000000 --- a/arch/x86/mm/numa_internal.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __X86_MM_NUMA_INTERNAL_H -#define __X86_MM_NUMA_INTERNAL_H - -#include -#include - -void __init x86_numa_init(void); - -#endif /* __X86_MM_NUMA_INTERNAL_H */