From patchwork Thu Aug 1 06:08:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13749636 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 F1C55C3DA64 for ; Thu, 1 Aug 2024 06:10:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D22E6B009D; Thu, 1 Aug 2024 02:10:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 683286B009E; Thu, 1 Aug 2024 02:10:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5242A6B009F; Thu, 1 Aug 2024 02:10:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 326B16B009D for ; Thu, 1 Aug 2024 02:10:12 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AB8ACA62FF for ; Thu, 1 Aug 2024 06:10:11 +0000 (UTC) X-FDA: 82402651422.09.5680B33 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 0736F80018 for ; Thu, 1 Aug 2024 06:10:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MFAG9F3f; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 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=1722492547; 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=MIAL4gYUA8ep2WaW6qhFjT4s3xw+5vZW8BEUKSZrYK8=; b=lAVaeKfe0pWZNdizDba9JjTkDB2EdAQd5mEYW/IXxoADKFZfrer1bC5gRscxsNK8J8641W 2dKoTPnz+g3Vawzo3/l2gKOt6UBFe+C54dqb9hbPZc+tcj4NwdmNp6WQdCbxLXfLUDWHwK wnc2vaklxZEapvBgCbM6ESlAx33nlbA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722492547; a=rsa-sha256; cv=none; b=GaxrV0L+2zUeDvD86xvkBUezoALjusiJshoEO8RUGOYXSP2eN/0oPiJkHtLTPeYmTpkbs2 KyS2MeXhWoCm3n1FZXGR2zkcD53l8VFVHSo3FEI8WA+nBWcUf4aSD0eAk8EamxEuI+o5UV GLbYyuQDH2sG/4gQubeo++QH/tactPc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MFAG9F3f; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 39F6E62502; Thu, 1 Aug 2024 06:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAB07C4AF11; Thu, 1 Aug 2024 06:09:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722492608; bh=+b1cOkZzBkabktp5Vtr0BxOA2OwItOU3swcoPl+STrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MFAG9F3fUnIEGckALXUsgPgJNDOGxKIktrZWhCPRrwe1l/PA4t95t0glD4Bw67Wwj 56IqcN7KC3zzeCXB3c8CrI5bl5iDUVSKZrsLqr43Ecm7gRjqRFCAR9bIDA59V6hoqm Xly5FwnM79IMgwgHQI+TPINCsSXXhleTBgnO0f80JBYd2cMfyLGz32VP93mcQrjqJA Ne73hzkU/Y8f6hDf1oBGnhpCmZoHktUlCUaZ+WLWYPT98uUNEZFkSQTU50QEbSbj1J 0OJkDgvPRbuCaVMusjazFYkXiGRxn2uK7gxV2/FyMUUmWwS+NFGAia450ymPPe8PXm gEBtBz7iXoOvw== 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 v3 07/26] mm: drop CONFIG_HAVE_ARCH_NODEDATA_EXTENSION Date: Thu, 1 Aug 2024 09:08:07 +0300 Message-ID: <20240801060826.559858-8-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240801060826.559858-1-rppt@kernel.org> References: <20240801060826.559858-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0736F80018 X-Stat-Signature: f5cj3dbu8jijtc36hweub8is1t9kk3qi X-Rspam-User: X-HE-Tag: 1722492609-663148 X-HE-Meta: U2FsdGVkX18BTcXOos0xX3d8XFfVi/pppXNaZmBd8E4Bt925Ut5xbZT3ml4EFZMrHdBD60QNHLyVooBSR4MmUtyXi7Sdfr4NRCinhRJ4WEd2574QA5VhpRmRtT301G6k+OOz9yuwTCgUbuWRveSSRWPl1D63DijpWjKiZYhFZ7cVC6Vw/s7vVCIVaWFMHIoVKEePa1u6Zjai4JQz6b/sMymIpyKtnGoqSaiDC0gaIrvkqD1OzUgtZqleyhI+tyNcUtNlhtOttbXFUw7n7dvZSyng99PlB6ZQfOor1icpyUAVX4jRruc1KnDTW+GvGn+b7m5YjVlfkVXjI0gr1xIoG7kREKnS4duyniOciYuBMKVWYOrcpNF/LprqOYCo4m+TIR6uM/iK686Njh3XgMNbZxQdKQ1ZfjwFuGealSqg7ruhm8sSgqzPvM5O0zIYT0W3jDHwJfq2kbOKc+ztS5uWldQAk7C/QtBWF5Y8P7+V+Qb3P/1PApDAOY6vEEACHkBDadejqWsPyayigoLAQP+6N5iCLTrn5/vFk7X+U9iX+BdR5qOnFZBZAIELpWB8p+Z4o/3X0h3UBI6t6ClokbkPst6e2MTKxKgf1jymDaR+d6D3uUXnvBZsA0TLEKgk3IQJTLgN9Zk5PTRKTFJA0za6ETVF4eh+jsGiKvo37S5g+v8CAjnUtYArL96tV+jMp8aG8ecRoGMAn4udBSW0vWYb796W1fTrpdwVPZ20v1qrZOcZtui6qceV/fjUuPyhk2IXq/V7fESHbZvi9qgEcMnZcdZUo7w+vvI9MzaALY1fxiT5DirKtg7nAEhX2Db8PBXdkjzFDoIGa7kOGQ54ySDSTdQ7u5INfY7RFYcIgBsPToUdaA7llXy08wqv7bXfg3sRSSAxStuX6aJJMUfFesVr5TTAoS4SoIsFJa5bsOvtSzjmjkipSXFBsKAnjZw7kqGz9G+chxv1zA03mw8Y6na bYBLM0zF RGm3ttcwwl6jzXRMzTpGYPcptJ0ONr6ZHua+8EQ8t4S2NoO8hhEaOM7rCArPRllT9rqnfaRVsOhf21uw70J8FMjOAjJ5FaXIRbfbWbDlB/S8vBaAOjaXZj9No5DEiPHFlJ05aRCc6D0Xs1wbY6/G/7DlOwkIt8RCqTIIhKsATLBNfD12Ohv1LrUANYTp4fg+6hedKDRD8Ik8ZeevO9IIMmKdTSQmmMmt9uvIFUc+gnd7v8bkq8AICaamnRUNGgbv96LzRewegGk9kJxNKSG9jF3VO5nzb6p+AZwXQgMOtXzOC/5e7tddjPn+Ky9DuGM2mZmY3ycUN0CyAcpubh/3OUu1W5Lt6enMe46cQ 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) Tested-by: Zi Yan # for x86_64 and arm64 --- 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 ebe876930e78..b27ddce5d324 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 75c3bd42799b..bcc2f2dd8021 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1838,11 +1838,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);