From patchwork Tue Jul 23 06:41:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4BA5C3DA63 for ; Tue, 23 Jul 2024 06:43:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 658846B009B; Tue, 23 Jul 2024 02:43:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 609716B009C; Tue, 23 Jul 2024 02:43:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D0016B009D; Tue, 23 Jul 2024 02:43:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 315166B009B for ; Tue, 23 Jul 2024 02:43:45 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C6E1E1C28BA for ; Tue, 23 Jul 2024 06:43:44 +0000 (UTC) X-FDA: 82370076768.24.941C277 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf11.hostedemail.com (Postfix) with ESMTP id 672204000D for ; Tue, 23 Jul 2024 06:43:42 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LWkFKSq6; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721716971; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wqYPGvGgpgJgnlo/IiQ292AHKgwD59ioancY2eC6w6U=; b=frCLz4ia7rWh+vEQaET0S19T4PIh71Xo85smzUhJvhh3NXScEXlE6w2/LlkOKObjJd9oq0 sQ+jy1mVTL3XX8TxwmeADkUuL9nmbBZXHxnbV3JGtGhvqvIC7i6RrZnhnkpdY9iWjTF+gM Z9OlMdwtCcmtD6dhObvr09UOMY8njes= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721716971; a=rsa-sha256; cv=none; b=5Q+rnHDMSbS7BKszqhtZTlbvmHcnRkarM1lOFNxCs34A7GLf+OSMQUXJ5X7O0pMuYxpmdk nVTYhl85kGJ1P2NunQrIbMgiUerwOjqQxwhVFHGSioLtxG41N9Krr6+eOEtclobL1tY6m7 1wfH8Pwq0vSEB68SJFEcyDFmvSt4ppw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LWkFKSq6; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 23612CE0DFA; Tue, 23 Jul 2024 06:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A4FBC4AF0B; Tue, 23 Jul 2024 06:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717018; bh=KMUHd3pa3/sGl5j0P1xwN5TvNIt/JcquxvbUe/9/m24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LWkFKSq6/pd3Gz6zgozY8S3W7YN4XbwG3Jb+Xk1cnC7gLl9AmB1RBeBbxRXvm10mo 9bPr1wCujAi72DOi3ZZ6MxSR662xYGaP/kzvSESqPfaz1lvZuDUlpNyX5dy0tZ3lAx vz+FWcxLgBq3UZrFr48M/v7opiixPXJGVSfeeBAwDCwB2EKwm/q6Ap7lwJBWSb6Ng5 jnpe/p1tJ4ATxte1nyJpzrRcOlfhLY+Hu2RL+8RHtYPodmwgh7+5jPEPXLaZj05dRa DhWm6z0Df650Ih1lo97lRpDW1J7ogEdU4fxwaf5/0kt8pUV2Fa2hUe97zXFTJbJXes bhLJjXOhO3S/w== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexander Gordeev , Andreas Larsson , Andrew Morton , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dan Williams , Dave Hansen , David Hildenbrand , "David S. Miller" , Davidlohr Bueso , Greg Kroah-Hartman , Heiko Carstens , Huacai Chen , Ingo Molnar , Jiaxun Yang , John Paul Adrian Glaubitz , Jonathan Cameron , Jonathan Corbet , Michael Ellerman , Mike Rapoport , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Samuel Holland , Thomas Bogendoerfer , Thomas Gleixner , Vasily Gorbik , Will Deacon , Zi Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cxl@vger.kernel.org, linux-doc@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, nvdimm@lists.linux.dev, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH v2 07/25] mm: drop CONFIG_HAVE_ARCH_NODEDATA_EXTENSION Date: Tue, 23 Jul 2024 09:41:38 +0300 Message-ID: <20240723064156.4009477-8-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240723064156.4009477-1-rppt@kernel.org> References: <20240723064156.4009477-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 672204000D X-Stat-Signature: 6a5r5iutg3r784bgjh7kraa4dpd74d7b X-Rspam-User: X-HE-Tag: 1721717022-580849 X-HE-Meta: U2FsdGVkX18Odz5zVR9gbQOrl4vXhzNJTljePYIN7SL8drmI8q4pKC6gyCIu2fthoP1UfDEeQI+zK8qWUCg0+NH3rO/h1PyHAubZS5vuoLIg5y995KmA/4WveW+SldMV3oUeFcMKybIhRcFtnvXe+H9/kBP3NUrysT+bDPadRhoKDv2rbrW5cUp3qwytKC4ApHSWNyxkyIZepKfSpyT+Rtj6rL+pSeNUcUzYWG9kQqbqjMd4rWbNJstf1s88HVHCtTyHytlU433u1LTrQJJedzdXIU2O2nZ9ryEMPH5aNgLnGeZrlpTBq4QV7jJJR28oDee6qnXFatVbJ+Ntt0St9aYyJy4kp67EpEp2PMELKiJiRwIGKnMjArCgiFseSez5N+tz3c6auB2HqEoFXe7Lfwwwt34SUGayDtxcsb6aZRatOiXV8ateBwE+TMm5qM+23Qmd7rDnEcaRD/aYsqPOdlO66tPxZbZ1nQPWpiJksW2tlzimXApJ2armWiYyxcVuZnOJYuDFT1ltICBxdrQEWpMP0mgx8jJUG0dsYnKPHIPlrAwN9v83o4JCzJKuJI/THofyCFF2LkZEhDt1IjWdfKfMpFc5ZLCmoYSGJSprlsX3hWJPe1k1UvAo3H0XCBVEz1yHa1bizq6e6+4215Gl+BfeeuRbcBRkkjXcce03LeBB6GNhqKG7QprD8CELqklO30MOMlgR19nWJ0CrPQsVejRrt4KhOdrrZVP1Az7GcZjkhg99SLyXEDGxSMzsjjfLne0ZRBpy3YDeXSxgtb37sLYW5xqfguiBXKBXYXArTqEBqoEZLMHfbfP82isXKHFmUVT+FnwyqviM/ODtGIF6ShFOJX7/yOwKNMpQ4Xt+eoE8lorLn9uhc6INq4l5n8S05XL9cWpH7lvwgvBCyi9MfpZqnMvhIUiMtYxaGL0tcrGSqBC7u/BD6o9Ejgmmkm8rujj8infh4m7PXhHTNdZ Synt3joX m5CvbNftCpmt3eutr+oGSmzdbbhM+YJo9OE6RUZcmgb3tO5kwr9hFv6XD516cqURLKDWMgE3Gy0PeVYkl4/8VNKEp7t7PGzKM6ZLrNq7nYvZErf7/x4ofJ7Pdlbd4V2llkP4oKp/EHfrTjZLOY8i+NoAITLH8DXuLftN6EXjcndtoAcfWoFSyVQQ28cHqSW3v7Lf3jaQygLJe8MfgEU33kWeBMg082MbH6McwXcA8R3p5FQqNS4XYJf79iOKEGHCTIPUqaewwEEuMjD5QAKDeUbfBlGpJRKUmJAQkB68ou9cf1ylU1C2VYAfXJPK6/BVpWMeibxemfnT3Y0A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: "Mike Rapoport (Microsoft)" There are no users of HAVE_ARCH_NODEDATA_EXTENSION left, so arch_alloc_nodedata() and arch_refresh_nodedata() are not needed anymore. Replace the call to arch_alloc_nodedata() in free_area_init() with memblock_alloc(), remove arch_refresh_nodedata() and cleanup include/linux/memory_hotplug.h from the associated ifdefery. Signed-off-by: Mike Rapoport (Microsoft) --- include/linux/memory_hotplug.h | 48 ---------------------------------- mm/mm_init.c | 3 +-- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 7a9ff464608d..978c0dfb64a1 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -16,54 +16,6 @@ struct resource; struct vmem_altmap; struct dev_pagemap; -#ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION -/* - * For supporting node-hotadd, we have to allocate a new pgdat. - * - * If an arch has generic style NODE_DATA(), - * node_data[nid] = kzalloc() works well. But it depends on the architecture. - * - * In general, generic_alloc_nodedata() is used. - * - */ -extern pg_data_t *arch_alloc_nodedata(int nid); -extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat); - -#else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ - -#define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid) - -#ifdef CONFIG_NUMA -/* - * XXX: node aware allocation can't work well to get new node's memory at this time. - * Because, pgdat for the new node is not allocated/initialized yet itself. - * To use new node's memory, more consideration will be necessary. - */ -#define generic_alloc_nodedata(nid) \ -({ \ - memblock_alloc(sizeof(*pgdat), SMP_CACHE_BYTES); \ -}) - -extern pg_data_t *node_data[]; -static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) -{ - node_data[nid] = pgdat; -} - -#else /* !CONFIG_NUMA */ - -/* never called */ -static inline pg_data_t *generic_alloc_nodedata(int nid) -{ - BUG(); - return NULL; -} -static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) -{ -} -#endif /* CONFIG_NUMA */ -#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ - #ifdef CONFIG_MEMORY_HOTPLUG struct page *pfn_to_online_page(unsigned long pfn); diff --git a/mm/mm_init.c b/mm/mm_init.c index 3ec04933f7fd..e1b3ea0523bd 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1831,11 +1831,10 @@ void __init free_area_init(unsigned long *max_zone_pfn) if (!node_online(nid)) { /* Allocator not initialized yet */ - pgdat = arch_alloc_nodedata(nid); + pgdat = memblock_alloc(sizeof(*pgdat), SMP_CACHE_BYTES); if (!pgdat) panic("Cannot allocate %zuB for node %d.\n", sizeof(*pgdat), nid); - arch_refresh_nodedata(nid, pgdat); } pgdat = NODE_DATA(nid);