From patchwork Tue Jul 23 06:41:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739428 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 6CF81C3DA63 for ; Tue, 23 Jul 2024 06:42:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E45D26B0088; Tue, 23 Jul 2024 02:42:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF7386B008A; Tue, 23 Jul 2024 02:42:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE5826B008C; Tue, 23 Jul 2024 02:42:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id ADBB76B0088 for ; Tue, 23 Jul 2024 02:42:36 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4CCE581CA6 for ; Tue, 23 Jul 2024 06:42:36 +0000 (UTC) X-FDA: 82370073912.17.BA9FC6F Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf16.hostedemail.com (Postfix) with ESMTP id 109BE180002 for ; Tue, 23 Jul 2024 06:42:33 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=b6kFqW4f; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.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=1721716903; 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=sYD9yS7nV1HjKmYlc35bPY0UhZ3EgO+OhG0j/XyBiqY=; b=UF8+3A8OxnJfLGmPlQG0OijK4X/BtrUPDJVoqQMHV/zNqPCzW0cK5dgYk9z2cZfUifHLkh Q+20I7YavAJqaMB8vD2q4Xj0xUREFLll0hs1GofhjrU6s6D9UIzac/eySDI0yEr3kK9sra uOz8KkQ2vEUZbFW21DWodVxYUvtKfGE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721716903; a=rsa-sha256; cv=none; b=CslddIMXNLrXgllZE6yYaZjCHDSqV/Prgead+aGwEx6XPD6nvIU1svBBJ1yFoSVqaSXfow 9jabLxkr4qp27cmfamMOzFeA97hlxK9tbCll2B9zbPBMCRlVufjD3Y4911C9IIZll571DJ FYHRXYy8/IGbc5Q7+5qtm4WNtWvSqUs= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=b6kFqW4f; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.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 8AB85CE0C6D; Tue, 23 Jul 2024 06:42:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B906C4AF14; Tue, 23 Jul 2024 06:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721716948; bh=MOsy21Nh9Bn3Vq+Q4UEQvGTzwylkpR0+vopd3cmOc8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b6kFqW4fzlXewzWkdUPTd5wHONXKf4PwHJ7rcvwCrxdIEdWmza/QKg9b1mM5EEx1b txHRwjYCnReOXccINfBSu63YgvwYTo4m938vTFiVPXindhW0+nt4L4nhySFkUjjYtJ QEnY12RVSXU4gmWybse3Akv7f+RuyOn/3e9yX5FpIPA4vnbnAxyIxN9d59MClKPT7y Wjb/LLqkF23TTVUf6ys9+IrvUVK7kMuO2WDzcj9pjvVf0MPSjX1Rq5xUVWFOrxw6By JbcMkFH9uNNmsftEA7Zq2i3mE+5SycQW1IyHwYhtsk2+LjCI19lIx+RUoBTZ0SDGUW LpVc7vZrknebw== 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, Jonathan Cameron Subject: [PATCH v2 01/25] mm: move kernel/numa.c to mm/ Date: Tue, 23 Jul 2024 09:41:32 +0300 Message-ID: <20240723064156.4009477-2-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: 109BE180002 X-Stat-Signature: ur8xfzp1q4s65k7587ezfwxue4r7rc3e X-Rspam-User: X-HE-Tag: 1721716953-48497 X-HE-Meta: U2FsdGVkX18+T3Lr7Py0PvwJ3+RzqG9j6HdX+OV4LEaRAAzJMiEayrpNMPIdUhHjn6wAs/qlR6wL3MZ+iRDIp7wITppMnPUNZGZ52X7UMkcjdxmtQjoOzyyISa1TBACvPVVbjmqlKgqxU3AaPMytG1ziMtho6SAySArNCNY0ojDItfDFdA/ndxQXlV93oceCRuijhrVEcyl62QOUjm6vHJ+4a9i0n+MEMZikDM6HI8POKmljxsgtXnkhQaL/4o5lH9Y49gVmsVKNpBdqNTxn1p9TZDaoLC9AZYdwvF7ABBKKUngOW5fFmqhsIhtN/d38YEOPp6l2iEUcXkqyxMIrTVw1QHHmPigCQIms344wB/EMB8A67fEeicI4bJlKY4LaOgpX7ZAe2JSZeS+0xv5iKtiwhTNbpV3BTYgKfVSkDh3565NEyXeD6Bbl/C+2ub3rz7Crcdb17vWsQOViswrcOEzX2W/gPkIdE7djJFeyZKlY+vWNKqB1Uwcn5mObLrnMUGcetg6C48CGRLf4xElrRLECZF/ms3JRBvDzFbKA1Tsc84vwYCE6stsf8SA3iERex5nbmT00WPM7t5ATZTL7BJXnk7K4vOMOJYb2vbbTP3aCeWWZwCCKWIjo+9Wrq/Y+s9Gv3oNtPnEk+HYH9FP3AwxDcGhlXBvvddIDMhXrQ/zK9g0uMwaRNZWq4IsC4yS4ietjYHCuTmjAMfd6zuC0eihpfNQCPRDXRzW++rivmDqrG+bKJ3hlOghehczNlyFykUnoSjEvx++DJVve4xc7cHHJKDoNwDD2T7iP56Vc9YTTbNzSMJNmEqgGFuIwzXuI0tGEt5rV/EXvUNQjA6eW30qNRGzSnd1DiaYHarvPh7uLeifJjqxMljBgqPHU9fkZBQQVsByKnChudnVdiD5VeCSa8IZTtSMp/Hu6iZXtSKAeXUKjU/Wfjum8hytZ9US8OXYhG9BoaN40B8MNEQb s7/JwBmq eBfSG1j4Y9hnhB4+OkwCdT+hgRbPGuk45PllTX7Tzp7xXS7vibduBfH+G0zHTtdCEBMzezpDbV4C0gDzUDDuAi0nEJabo2Y3wGoFHrhZwzqzOmzkKMJ0Os6PcrYG1LctuvTVWZJV8p2BaQ+Q46enVBbOkPHy2DJgQrP9bk3OWSLfNisBpd4NZNpHGV+t4sV5iSaep+qZ9z8lTINVFi5ASxhRBBn68DSLiX9+ObXq5VZl5NRtgYT+/pWd8/++3PuB8YWfVmc6uJVgujp3i8f7AFqbKDLaXtE/bxH69gDLDqUi1bXq6fI+UUPaK9D5oLBvb3KPj 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)" The stub functions in kernel/numa.c belong to mm/ rather than to kernel/ Signed-off-by: Mike Rapoport (Microsoft) Acked-by: David Hildenbrand Reviewed-by: Jonathan Cameron --- kernel/Makefile | 1 - mm/Makefile | 1 + {kernel => mm}/numa.c | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {kernel => mm}/numa.c (100%) diff --git a/kernel/Makefile b/kernel/Makefile index 3c13240dfc9f..87866b037fbe 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -116,7 +116,6 @@ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o obj-$(CONFIG_CFI_CLANG) += cfi.o -obj-$(CONFIG_NUMA) += numa.o obj-$(CONFIG_PERF_EVENTS) += events/ diff --git a/mm/Makefile b/mm/Makefile index 8fb85acda1b1..773b3b267438 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -139,3 +139,4 @@ obj-$(CONFIG_HAVE_BOOTMEM_INFO_NODE) += bootmem_info.o obj-$(CONFIG_GENERIC_IOREMAP) += ioremap.o obj-$(CONFIG_SHRINKER_DEBUG) += shrinker_debug.o obj-$(CONFIG_EXECMEM) += execmem.o +obj-$(CONFIG_NUMA) += numa.o diff --git a/kernel/numa.c b/mm/numa.c similarity index 100% rename from kernel/numa.c rename to mm/numa.c From patchwork Tue Jul 23 06:41:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739429 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 8E363C3DA63 for ; Tue, 23 Jul 2024 06:42:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 128A16B008C; Tue, 23 Jul 2024 02:42:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FF7D6B0092; Tue, 23 Jul 2024 02:42:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F086A6B0093; Tue, 23 Jul 2024 02:42:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id CDA646B008C for ; Tue, 23 Jul 2024 02:42:43 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 41DEA81CC4 for ; Tue, 23 Jul 2024 06:42:43 +0000 (UTC) X-FDA: 82370074206.30.4CEAF87 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 95CF0100004 for ; Tue, 23 Jul 2024 06:42:41 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=L4fNJ84X; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721716916; 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=mpDA7GewTCgHjnhlaK2zN79CV/6fdKT07FqjCbVF80I=; b=mDgySPmpZBhYC7R31qSHu9IXDrIHCO+gEmOL1gOIRGY9SB+H5daiiYpMXgFDqEvGEyaERI NUqWZWKIOAqfOyPkHJ2Z0A1KxxrnOp/dOZ/JOGHPqVvryu/viwNuofY3nVa8b2qYb3N0Ms 6MtfLc90xgLwX61NiY/rrSeldxkBswM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721716916; a=rsa-sha256; cv=none; b=1wnnxnZnn4QXVpTKfffP0WDhXlb/JfcQIvI1rSvIW4VLcYR63Tqu+NnM+SKXYb5U2Lkp8/ XnjxxMDkxNyqc4S1s/ryujnvj64PkleQGIHfcEBzoJhuhGErZ98rv5dnTWDFPtqcKU7krC 8iHVftHyAMeYronqD3yn9kvRreFEZJo= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=L4fNJ84X; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B5DE060B98; Tue, 23 Jul 2024 06:42:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65428C4AF09; Tue, 23 Jul 2024 06:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721716960; bh=wE9udk3T5PUOzWhffSqfqF0jfi91yVWMRgCuaEhaWIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4fNJ84X321lZQzRVwm/9NQS5NvRjUpsrvUknu/25CNWvxfQJeLO5JGwoMu66FrNE yvDUpLniReSKqIGbvqtVRByoS59WWzegjXjEaI/pSrYNABzkWG217PFiU/HwCkFTUq g5LaEICTajd27yc9CaZWhZMte2v93pqn/oc7mWi2RjQwmIaj9fD9pBiOpgfGeAY97T Oe4NEENOMypP8RnZtX4JhQBHzOIYuexn1Vt8ZCQFxdsT1om7AChjHOPoOQjfy6zd24 JMhzIfEW86NpfX+IthkEOW0SXal75QemXF5ziyXOa5gbgR3IX+M2Vk2vL97MmOTzDj iYFpZ/HwvvjKw== 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 02/25] MIPS: sgi-ip27: make NODE_DATA() the same as on all other architectures Date: Tue, 23 Jul 2024 09:41:33 +0300 Message-ID: <20240723064156.4009477-3-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-Queue-Id: 95CF0100004 X-Stat-Signature: j3whr5okhy798cqjmkymg6w4q9syjpzz X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1721716961-22162 X-HE-Meta: U2FsdGVkX1/QbjFG3pPwvy1GWIKcTIxJgv08Oarg4omFQuOXHCIrLpzJO0p2gPUUrrakdadooN4bsB+TnVJr+3jlCffl/Le0ABOBhiZfTUhSG+3NGbwWABwiE376K1Wb2lLSZW2Yl7tRkD34UXfVG6CzjHvRtXmZfdCgZl4K8WpXfOEPbCNloMbdLAapNsDhqvqqJ62UvkLuslfe0PXFnQKpY2+VdnH+2qBZv/yhRxpIit6yAXYHADcN/5oEf6tuaxrBqgL98YSKraC0YdVP7Ay5Ewsyi34aWq4/izDEyaEQkzjWN3x7OuCDcRNYtokJ5M+yjclTV+DPYvDYRAM7AvvboVU6fbkKxXOLHr2GVGXCojlaT57HNWjF1klRgHTQXNLUJNF1z33T1ZuZsX2ez/JWvP8ncb76lSFuGLjnf8xpaaNZqRbsqfMe7dX9oXIr1qogb0yH5LSrQRgmVnnHk/csK0ibAHjClD5qTf+5pPevBDEMPsBRSgw6954VRMwl2fl28vRRXqCIrMklg3eSX8JMRGGPV7xhml2/eXAspO6IHy4XevkHdoKIM17/icXXMOf5KWcsC3FguMPjlTbWPTe53+Va1+G0ddFQDcu6XgpaUAhDCL5lKmGsyo9SfnsA8n5zvh/dIIay0Dwj2DsI5cgxXh5j3ebXRSQ8jlcbAnbppzp1YDQFCKZH3SokPoRfHATDk5nZB2stHCo3p9srXkrKToq7/cYB6Jenae7+dRE/KHU/EsCsgcuGFBNSmaa+0VTeGmHcrLio1BNjW+4UQXxMPzPxRKB82IiqTCPtI0IHKsO+bqLalMUVTl+XFR+e2aoHxHSYoR24VAoo2VZcg8QliDByADGwL4DHwTYNV8IqAwJ8WNyqY6N3uSw+/k83lifYVKaCj66Jdpni5eXe5DFnm141rwxJzNdo/XNu8xX55/LQIeqkk9CdsqnICunsc8c9JK2Rq0tztGBmHvF e/Q8dETI CHXN8xyVs9AjfY9Prf0xdWlGuD7A6/q49+qCsX3NkbETiWXVV7r10+5wtTKnVG7Z/ciY0czn94Tt0gTFPdV9HeqF5Yo+4FFNuYV6LLcDRoN/nFCkDnAX/AOuLWkvKzUYkveb8NVOccpiTXrMLT2c3PzK1aleq+rBsY78zkxZJPSy/mUjivO6p0Z5gk+YGq/dKVBzVJtMqSejCq84/7g1Yz50aEGwIOhTMYxDaFez423vOoapsmPOM4h2niqquZs0MvIyPJBeQikxOrhCucUaRH9rDANZ65licDbl6Wk7+ntD63ZncEfy/AgGd7MRYn0Pwo0fWWcNjE0wo4Ho= 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)" sgi-ip27 is the only system that defines NODE_DATA() differently than the rest of NUMA machines. Add node_data array of struct pglist pointers that will point to __node_data[node]->pglist and redefine NODE_DATA() to use node_data array. This will allow pulling declaration of node_data to the generic mm code in the next commit. Signed-off-by: Mike Rapoport (Microsoft) --- arch/mips/include/asm/mach-ip27/mmzone.h | 5 ++++- arch/mips/sgi-ip27/ip27-memory.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/mach-ip27/mmzone.h b/arch/mips/include/asm/mach-ip27/mmzone.h index 08c36e50a860..629c3f290203 100644 --- a/arch/mips/include/asm/mach-ip27/mmzone.h +++ b/arch/mips/include/asm/mach-ip27/mmzone.h @@ -22,7 +22,10 @@ struct node_data { extern struct node_data *__node_data[]; -#define NODE_DATA(n) (&__node_data[(n)]->pglist) #define hub_data(n) (&__node_data[(n)]->hub) +extern struct pglist_data *node_data[]; + +#define NODE_DATA(nid) (node_data[nid]) + #endif /* _ASM_MACH_MMZONE_H */ diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index b8ca94cfb4fe..c30ef6958b97 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c @@ -34,8 +34,10 @@ #define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) #define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) -struct node_data *__node_data[MAX_NUMNODES]; +struct pglist_data *node_data[MAX_NUMNODES]; +EXPORT_SYMBOL(node_data); +struct node_data *__node_data[MAX_NUMNODES]; EXPORT_SYMBOL(__node_data); static u64 gen_region_mask(void) @@ -361,6 +363,7 @@ static void __init node_mem_init(nasid_t node) */ __node_data[node] = __va(slot_freepfn << PAGE_SHIFT); memset(__node_data[node], 0, PAGE_SIZE); + node_data[node] = &__node_data[node]->pglist; NODE_DATA(node)->node_start_pfn = start_pfn; NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; From patchwork Tue Jul 23 06:41:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739430 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 C939BC3DA49 for ; Tue, 23 Jul 2024 06:42:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 594C76B0093; Tue, 23 Jul 2024 02:42:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 543F46B0095; Tue, 23 Jul 2024 02:42:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40BFE6B0096; Tue, 23 Jul 2024 02:42:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1E6636B0093 for ; Tue, 23 Jul 2024 02:42:55 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C10DB81CD5 for ; Tue, 23 Jul 2024 06:42:54 +0000 (UTC) X-FDA: 82370074668.18.22C3B28 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 2FD568000C for ; Tue, 23 Jul 2024 06:42:53 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Jjn0IMhJ; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721716927; 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=9FVQIJBvwpLpWnxssYSpgj10sNF0Z4o30ZuUMNufdPk=; b=pXSYyPN3p4V68b13//uquLBX8bDJeBsBCz5+f2N2nBoxjPLHfGVyVOcqKXm4uzuRvV097n 96YG81liriekLjClh+ZxvEmEneRJWpUT1eijso5zFrHIkIRIna4tyuYnjm6rF9lWLaVNcE u9vvyPcyfZPXPfGDELJ0D/2bh1ge31k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721716927; a=rsa-sha256; cv=none; b=6FiB5azvhmB/n7EJj2KbkbX1xGL/UmpwEuEBTnohD7BzwhTvXtOtfsY/mHZzU4BoYvhaFa b+7ghlXPVPhua+CUV3ygflatoUHzgR0tE6XF7EIwBhaEdvLomZj0eeX7OarusGribgUrwM UrN3/AycdWcMxEQ0HuC3T97q/2IbrCk= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Jjn0IMhJ; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4A56860D2D; Tue, 23 Jul 2024 06:42:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE7A2C4AF0B; Tue, 23 Jul 2024 06:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721716972; bh=mRZLqq2N2ryJ5ZO7g59g+rrLvkwOpPlbSt8yNKJxh4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jjn0IMhJcrPhS4Bl96Cwo0k6df1nhuQSiNyQ/dbVBMzBCcrp9rXxtpGaIPsnWwg1g EutfShLwl4ML33LtMf4CMUXhriaZXC2Y0XnDQ5eHWFqH0oTLeSRxwYQvMiTH4+3pg4 23X5S2IXpSsSIpciOEufgRtYvvNy1kJjTIubaTDearGmucjQ2peycwqBYrl0lnidvI C3r1Rp8+mjvm7PE1YQsVU4cLUmpqTmzFmPLSRVzjvocHAABjPDxVifYy/vK56oo8wA 2FidhSRWcQ1vbPPvkPNtW95l80WFNvn/FUjHRkFCWUy8NwC+vz8A4Ft0biSW1xNoPs CVT7tSIze5Nug== 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 03/25] MIPS: sgi-ip27: ensure node_possible_map only contains valid nodes Date: Tue, 23 Jul 2024 09:41:34 +0300 Message-ID: <20240723064156.4009477-4-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2FD568000C X-Stat-Signature: 9exhrxwgxb1i7qwkbpinban3xsnozdam X-HE-Tag: 1721716973-502826 X-HE-Meta: U2FsdGVkX1/HcZHVZbmyDrAlrCJzyan5xm9FH78RsGp01qnvHgYkmzoIu/kJ38FEFkeuVV+ehQCESc/Mk9t46YXC3k30cenosYrIMtFab/SRLwnDZtnkQq9sOIbkip51WVb0+DSN92CW/en2q3x49klTd7+sy8qS/IRnR7ZJucoUKO2d0tV9iICVq2xnlBT3u4LB6LE/0/Ptv8zR8HBB8Mkr1qh8AvHOvkTUQ3mtYEk24w5wWxovCUju2tXbD0T1BrmnDL0ONi4Q4cF04Ce028Vg1icHit5cSDPApkSGCQvWViuCxZwiTYFZs73nNG2JJNHissp/hwFAG+GkDWj625qjz4S6h2CfuimmU4WF51fOSNxmhPa7tWMf701DkbbegkPnJypnRkrBgF5XbLcZ633r7Vn+mA9lji01lalHwIE7LNWVWWh+c9bMov8D4NJjU1q8FArX4EljPFZBh3x8mz9JOgezY0NDGRl0z6LeDQXrNTsS/LJm35HmMxLQtTVrEK/Sm0Oyw4hrAmzKJiwWDUIQT6cD1l04aipIDuOclbofc/o1Cbgw8a00guVAEEZRXiVG1B5sTgnf8zsK5KGhBqN6m35xXZUcrPo3nzYUXybGHxFwsRqrx4TYvy+OjwyEZSsshNxlgSQY4tNvkeA1yqYefxSubbpvhTNZ75tvEcoHSaHaPrkdnwxYF/dfZuLs699hTdXI6R0G2Z4WUCqxflIm6KAf44Y2PNWsbMKtXnNph6YID34tIXa2EZlElMTpLr1VcrVF+YbkNfnU1r4Uo77uG6qOUBzyFouyYz0893kvbePY6rgj0RAk3vHHfTePPLTjtoOlvrNDlikxuMk4zGb37UZe+dAzitWZMSWqVIzDM5p8K42gAn0g1lkLks2U3sakPOfqB70nF5gNgSFUjZzVe7szRGy69VG0bU/9PI/jp+OU5h6UoqPmOxXb8ZMMFKLcthGEdewcKelS4Ah GdDNqRhk Cn4lBXWEjSylZ0C9wPaD3UjCIo2YOCCq+riQWs2Smzq5xSDU9dmhRM6ILJzFKefLXDqwynZV3yXQSMvElP+O0bPU7EJc+gBNraOTXT+YesMO0fwym9EY3QBlSuA/Dwth8YPNnn1Ge8BwU+46PyVKyqx4i1WRYJOe9EsHBLdGm8KRdemfwOPAd9lFc4nCsV+z+FWWLi9ZPJ7T54Ngawa9pnhj57tVqdIlspjLx+vfjiWc34dw8mQn07j9hhQQZqzm4KhXDE7biUXu5WzUZHUKJXjtDXnG6cwPEsSxWdE7UP4o5kwZEmrgHK5ZgGPvYT8/zujyC9WjJ7bPqNRc= 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)" For SGI IP27 machines node_possible_map is statically set to NODE_MASK_ALL and it is not updated during NUMA initialization. Ensure that it only contains nodes present in the system. Signed-off-by: Mike Rapoport (Microsoft) --- arch/mips/sgi-ip27/ip27-smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c index 5d2652a1d35a..62733e049570 100644 --- a/arch/mips/sgi-ip27/ip27-smp.c +++ b/arch/mips/sgi-ip27/ip27-smp.c @@ -70,11 +70,13 @@ void cpu_node_probe(void) gda_t *gdap = GDA; nodes_clear(node_online_map); + nodes_clear(node_possible_map); for (i = 0; i < MAX_NUMNODES; i++) { nasid_t nasid = gdap->g_nasidtable[i]; if (nasid == INVALID_NASID) break; node_set_online(nasid); + node_set(nasid, node_possible_map); highest = node_scan_cpus(nasid, highest); } From patchwork Tue Jul 23 06:41:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739431 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 ADDF2C3DA63 for ; Tue, 23 Jul 2024 06:43:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4354E6B0096; Tue, 23 Jul 2024 02:43:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E5336B0098; Tue, 23 Jul 2024 02:43:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2ACA86B0099; Tue, 23 Jul 2024 02:43:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0AD8B6B0096 for ; Tue, 23 Jul 2024 02:43:10 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B2905140232 for ; Tue, 23 Jul 2024 06:43:09 +0000 (UTC) X-FDA: 82370075298.03.19AAEAE Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf26.hostedemail.com (Postfix) with ESMTP id 6C98A14001C for ; Tue, 23 Jul 2024 06:43:07 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y6q4di16; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf26.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721716950; a=rsa-sha256; cv=none; b=4yv7zuityGMsXML6eHn1JOebyXIZT0P7PXcLc9Wq4ejPd7uUMon8jGCMeTNMCcZnT0ZycJ vHk+WlSW5jk8ewnlzOSaPoCqGX/iaYpcAIJplcjomX+yU1GkNsP+kTyThw7k3csi6Dd5sC WD+vl//bTjRGsB4pQ0A5tQZ8ODE2cr8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y6q4di16; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf26.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=1721716950; 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=8n7+pZzK6+WFbmHoG/C3Mm8rEIVJDKYJbiiG3SHlmv4=; b=N0R22PZ7Ig3SXc9HGIsTxHZN7DtCUFKH/hetkP21GGzkb1wgPK/DC7tN1sVT0YE8rPibIl VWfgm3bSvqOQ+S5ztOZ2Gd2ZFO/ypnER5I2fBskUKFoD7DnDWdCBlDdppN0OC16hWE35S7 W+xX9nGJPRaHAbjaG0alrf38vr5rIvI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 3CF61CE0D9E; Tue, 23 Jul 2024 06:43:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81FA3C4AF10; Tue, 23 Jul 2024 06:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721716983; bh=JjgIyTKyYMJEXmrY6iBKzQREjmuG7L6VHXSpEqp+u6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6q4di16/02FGfX+NKF4yx+rIcTYq07N0OxPOONcycTUcZeXWWAg2+tx+rB5WHgfz tsKcNAQI4BwTkHN/3v2QX1cY6ojJ2lI18zljRvYbx7HafeGw5Pxe7uDhrsU/knMhF1 sGv6OFNaO+pEUIsgk7TQXeN+ZdJqc3rlk4PGDqWy5Oc2MdgiN3FrA7AaAf3CiZ2AN1 ZbDg482Hlr+8t8pxvFNK458eAQFx0WMXdPrjGy/8R3glp7z9UTqm15jP9l9A3rl/Cd WTFGFwzRouQDOKzSKcD5VdKfKWOZKZs0wjR3BtKbQp+l1R4vFsdv+mBPtEeJsjeErs mRBwbG4jucomQ== 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 04/25] MIPS: sgi-ip27: drop HAVE_ARCH_NODEDATA_EXTENSION Date: Tue, 23 Jul 2024 09:41:35 +0300 Message-ID: <20240723064156.4009477-5-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: rspam12 X-Rspamd-Queue-Id: 6C98A14001C X-Stat-Signature: muaonwjqztpjh1mtfdb7b4tfrke3r4at X-Rspam-User: X-HE-Tag: 1721716987-552902 X-HE-Meta: U2FsdGVkX1/7f5bnPvSljbqAKkyq2m4wtgcyBjNb/eQlQMGb+IdXIBDU0ZdhlXNsULI2jA49bUq3Ju0x/QZ3c+IXxtHEEOYFgE0GgpcmJ//brvdMxDtoEdAjmn/IZxUKMaVCNOZuuTdUuTUdpCHGkDBF33jcKCir1cxM2apfrqzttVsRltAIUgwGyv6Ob7WPFwaFZH15HpW7RH4CQrCNHWBZNqFRq/3Pgh3j2FKtOdsuc2n8J4ij5tZGdCygKuip9Cr+6XyCVUkkwPSTCDdhApBjV/SXMHcnoTb8dy+yYD/1IPOKaiYyjesEpv3Vb1mYNi7CVR3LcBQ5WZ0Rm8pS9+DaTB5/8/zT391IXWn7mN7/1cqHUCEFzh8kFg3t3zk69Dnb1HyPkamJjz/ELD8gvG5Q5IY1M6Jy7uw8A1i6ugfjNxRysp0lk6V/r/jzFfWh8IOXsejEcoriWzhzEzkSCDe4EtWkYNaVlDzor08U81gKOOjxEzU5oPHwbzecXLq7jaCZmVa3rL5K6CudlKWbI8WhIzhn8WQXHckkeHYE/PMQIYb2Rt+5dj1WIe5u+/cDj2SCog0M0g3KGS84W/2A9F5ySejlNio+1rqDyioUrTcBAy4NLA+E2Sx6nC5d+SspV+ou96sWzWQyBGpz5GDj3IFDc0DiB6FvhfL435x9yj7tuDvalFfH7mc7AILMSoIrgNKwN9criChXDs45lciJoqVnEiKkUsyLO1y9z4TmohTwqzCGHOm+MprmcSC1q40iqxqQmZ98e4n6URJ8yyQInEO7qyDZVbF5FOiC/FDrscDGnnUPoN6EHkMtocMMSBxPhrPJ6e2lWXUlq/4BKDFq6YMnucjXKGdakROSlHcpbzuaS+I9wOtFh+ywY6Tcs5Z1I1sq7NfXJ1ZisuCrr5QTewNOvlIpu5Ra9VVESwoK9UeIucxivitOjzzhyVe+DXCJxiNkQw21wDdQQWz91s/ cexga5rP sKiygQpFx50s5zxEfehMvmXujCYzwmsXurR1hyAY28FkiwkT0BFTCwqjyw1Cl2xvUAoSJTqZmcYrIuWrWPKOqAp6jNPMBPEvM9ojLPpgiwCGnkN5YMTBZoKcgQX+D8eN14lK6OwZme7l8SzU69a2hbtXUkixOmEN2OZ2ydE9YFcc4Wwb5GY2GPihU27LBdi4UAD289Y1DptpH6gyL/hRSU546uv4R3bK/rJkMaAIwUP77A04UMfMYXJ3JavJJeNVSJEgSnGRF0UJzgD6euBOPWkxRtENvomh+DD3e+2a/BabYltdQA20Su/Kq3LsxeQcqXlmp 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)" Commit f8f9f21c7848 ("MIPS: Fix build error for loongson64 and sgi-ip27") added HAVE_ARCH_NODEDATA_EXTENSION to sgi-ip27 to silence a compilation error that happened because sgi-ip27 didn't define array of pg_data_t as node_data like most other architectures did. After addition of node_data array that matches other architectures and after ensuring that offline nodes do not appear on node_possible_map, it is safe to drop arch_alloc_nodedata() and HAVE_ARCH_NODEDATA_EXTENSION from sgi-ip27. Signed-off-by: Mike Rapoport (Microsoft) --- arch/mips/Kconfig | 1 - arch/mips/sgi-ip27/ip27-memory.c | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index f1aa1bf11166..954f12a9e669 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -733,7 +733,6 @@ config SGI_IP27 select WAR_R10000_LLSC select MIPS_L1_CACHE_SHIFT_7 select NUMA - select HAVE_ARCH_NODEDATA_EXTENSION help This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics workstations. To compile a Linux kernel that runs on these, say Y diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index c30ef6958b97..eb6d2fa41a8a 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c @@ -426,13 +426,3 @@ void __init mem_init(void) memblock_free_all(); setup_zero_pages(); /* This comes from node 0 */ } - -pg_data_t * __init arch_alloc_nodedata(int nid) -{ - return memblock_alloc(sizeof(pg_data_t), SMP_CACHE_BYTES); -} - -void arch_refresh_nodedata(int nid, pg_data_t *pgdat) -{ - __node_data[nid] = (struct node_data *)pgdat; -} From patchwork Tue Jul 23 06:41:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739432 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 090F7C3DA63 for ; Tue, 23 Jul 2024 06:43:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 917D66B0099; Tue, 23 Jul 2024 02:43:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C7DF6B009A; Tue, 23 Jul 2024 02:43:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B6686B009B; Tue, 23 Jul 2024 02:43:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5DC2D6B0099 for ; Tue, 23 Jul 2024 02:43:21 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 180D1A5F48 for ; Tue, 23 Jul 2024 06:43:21 +0000 (UTC) X-FDA: 82370075802.07.2299E05 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf18.hostedemail.com (Postfix) with ESMTP id CEC611C002D for ; Tue, 23 Jul 2024 06:43:18 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OfSN7mfv; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.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=1721716947; 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=IBy4/NLvmneL8TuA1RJhZHs8+disGE/q3myWSe7l0P4=; b=fRc0vSz3pIb7YlflLT5jJwuHjIijmYVVLWY6rhuhNC1WFTvAQZtUOpI4uyxaKylkS9A+iD tehpjDb/V+10U7RgGmnRW2X1spfk8sDcZnUqtJZ+x/Ia5ba3g2+eKWqUfXv/ArSgRuGZfd J2cB77BK5uvOOpC7I+OmdeuzuMa8Pd8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721716947; a=rsa-sha256; cv=none; b=W2WVo9kB5b5EyuEfh9XdsTWorfHvnIbozmtTsGt5RSsgYq+8S42TfidNdZb+a10sQ2joSn 9qEKXuYJuxGDJbqNnZgzwS/oHVKfXenbqD0eBWrHGFtt23M0wfvVeLR81Y2tgps4kOtVRV /29JMJHfssEEsCnfXj0wy8rhLB154Sw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=OfSN7mfv; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.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 08502CE0E01; Tue, 23 Jul 2024 06:43:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A439C4AF0F; Tue, 23 Jul 2024 06:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721716995; bh=jUiExhtxbXLJEeICWPE63efzW6eqLaOxDv+h7X1UR1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OfSN7mfvIUHKBfqIhZu4h7qRRVMm+y8oNmA1PZ8IOgiRONyTkevyAn920tkmmmcKr xpP457bzAjQ5o9Old6pNpgfaMN77kH+wg/flNiNsqar5IJx3UlJfc28GlDvb8g/Nki 8YLM7G4hBB754wH8MzGzVejX8YEGGOFCBD+gjj204V9qWaf5iAgw1msKGw+93wNdiU Y/T9WsphBVb4jLUNIMh8fHzvQY7N57NFxeSu7sOI1PkKRtoBgEoaNx50ekhLLAYrkT rCehBGnW5IqnZfy3tDX8e9KwEEcASO0sRUWPNvbMrIy6RXKo7V247p2U1rVniZYinl SIgVomUX1tYbQ== 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, Jonathan Cameron Subject: [PATCH v2 05/25] MIPS: loongson64: rename __node_data to node_data Date: Tue, 23 Jul 2024 09:41:36 +0300 Message-ID: <20240723064156.4009477-6-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: CEC611C002D X-Stat-Signature: jye6ackgfgueb6ob4udj8wa7p6w1bozs X-Rspam-User: X-HE-Tag: 1721716998-355570 X-HE-Meta: U2FsdGVkX1+HxyCW6/+TCwPsBT7OcE9H5a6pQC2xBuK88ypVtmbUPCtWH6tW6HEzXAsyAqlsYkX2+sJKZQaHk7uPMKF6liDODpG3tpVxo6uG1ad21l38l1oYPLHeY9nUtSDidRz0vXuzjVrstw/OargPc27Uo8mGpTKJQ9zP5W1eQLZpaSVfVukhtwQ19qe2oo4AZW3yyZ28YPTt97qVkMI9t8mb0k9ev3BfzUjbC0qA6sydOlmhQBq3b/YqZjUbSPhZ8Ryaxc+m2x2W3s1znuN39/T8kmLWn+ZwWfcYQB2HBlJGEMSSbXOkAa9knpioYQB4e1osTPxURE5Z+7OxaTD97ytRBFdzIA5WbSZ/DHqctgK1s3W88OfRkM2MUQYjsOffTC1MNcwhxwpuUK3uLiFUPty+qDweJg3jxIFWBl+EvaJSYH06Ekw4S0BrQjVnJBGQH9DRv8pwCBxlopbjxf5PFjYRPe6j4LXJ8QbNu7rZ1/0vGAJTeZMh1PpTIg/b2ILRWBauvITIigabBCgS7hgQ5i0AQP4gfIbUZ//4kOzwzCy61S0WeZWAWPeSFva7WGmJbQ4T0PfWzqWtaqQzqIzNjbYKleVgEXIsywFa7VqAO4jSJyD254sIjEMEQIWHBB6B3wRzadaqZMitUggNCmGWxcBVnDg0MxaXdiGdq8T6efmmIv1OWJoXenAknXdIiaGKTpA4bmwnsuz68h9/lYPxGpyGYZF346jfI/9Kv2NMLBzG0f8EyCajTupLl43dfMF3wiGWtMsnbCi+5Rsy0Xwsbhzi3Z31t5GnSWCXK7+azROhxI+lGDf8+fGcQZAbw3MLCsAjO68sgnaQxWC//k1ZOAVtpar6egUCVbysQbszcRRksxdPoqjuBEad0QvPAorEPhBqQEg+yCxgUFWcTrhjl/a4CCAQR3CNJLFWWSYSiJiAizNXOAFhBMFrPQ7R5Uw0h8/ihP2ZMmCebeU FoNvHiDi A87u89hU4etspFLOKL4zSGGv5tBxnSIzOP2032P+0+Bm5hR+f5z7pMA436iQrAHewgmczd1WR2uzD7SOj1RZBdKw0t/UGJYodIjEk5MHdmOrl6dl4kQ65ZhhgmFJnbw8bZ8DIt0iFnoXv2jMbloE6JSwkN/yNWE7vcAdYs3D5VjhetiDrJG4yWAg60a3Po7fg1EYMQDtbJJva1km/iY/Xi87bklF8yfXSAJb9HZai7KQ6kKH2m0q1pGLVYFqdgyTo6qFD88srFktjB/RXLkxY4VeVoscrdg+yAzRymxK4zstd9Woj9CjEi4StIk7SRD/q5+XHIgMKutkysWq004qkx9GtLA/U6reWPp8vZVf+7Gvd8X7B5UsaqhwfTreWrAKy1GRBJjYzEnf2dYQa2+PlVCikRazNfzIuGOk7xo+ER/ULEtvz5G5iuQQrrQ== 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)" Make definition of node_data match other architectures. This will allow pulling declaration of node_data to the generic mm code in the following commit. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jiaxun Yang Reviewed-by: David Hildenbrand Reviewed-by: Jonathan Cameron --- arch/mips/include/asm/mach-loongson64/mmzone.h | 4 ++-- arch/mips/loongson64/numa.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h index a3d65d37b8b5..2effd5f8ed62 100644 --- a/arch/mips/include/asm/mach-loongson64/mmzone.h +++ b/arch/mips/include/asm/mach-loongson64/mmzone.h @@ -14,9 +14,9 @@ #define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT) #define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT) -extern struct pglist_data *__node_data[]; +extern struct pglist_data *node_data[]; -#define NODE_DATA(n) (__node_data[n]) +#define NODE_DATA(n) (node_data[n]) extern void __init prom_init_numa_memory(void); diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c index 68dafd6d3e25..b50ce28d2741 100644 --- a/arch/mips/loongson64/numa.c +++ b/arch/mips/loongson64/numa.c @@ -29,8 +29,8 @@ unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; EXPORT_SYMBOL(__node_distances); -struct pglist_data *__node_data[MAX_NUMNODES]; -EXPORT_SYMBOL(__node_data); +struct pglist_data *node_data[MAX_NUMNODES]; +EXPORT_SYMBOL(node_data); cpumask_t __node_cpumask[MAX_NUMNODES]; EXPORT_SYMBOL(__node_cpumask); @@ -107,7 +107,7 @@ static void __init node_mem_init(unsigned int node) tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); if (tnid != node) pr_info("NODE_DATA(%d) on node %d\n", node, tnid); - __node_data[node] = nd; + node_data[node] = nd; NODE_DATA(node)->node_start_pfn = start_pfn; NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; @@ -206,5 +206,5 @@ pg_data_t * __init arch_alloc_nodedata(int nid) void arch_refresh_nodedata(int nid, pg_data_t *pgdat) { - __node_data[nid] = pgdat; + node_data[nid] = pgdat; } From patchwork Tue Jul 23 06:41:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739433 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 B2FCFC3DA63 for ; Tue, 23 Jul 2024 06:43:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4834D6B007B; Tue, 23 Jul 2024 02:43:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4330C6B009B; Tue, 23 Jul 2024 02:43:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D4D46B009C; Tue, 23 Jul 2024 02:43:33 -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 10CD36B007B for ; Tue, 23 Jul 2024 02:43:33 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B272A121C69 for ; Tue, 23 Jul 2024 06:43:32 +0000 (UTC) X-FDA: 82370076264.09.5AE7239 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf14.hostedemail.com (Postfix) with ESMTP id 71903100003 for ; Tue, 23 Jul 2024 06:43:30 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ODt+aK2h; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721716964; 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=ZhJi20MUOJfePJcE3KmljE/8WO+yAkTjb2C+l4o3Q9U=; b=CUDQuUDUDDlYZ/dNDczZwpUdWLe3m65NvdWbi7/edoL681XCc7eYD2uJlIv/5Btxbp6zsh jMzFlBLG0pB0B8vDHreqafAZest0iCAqUXICYt5vM66zjDea8rBQOAH862xIRxC9rAyT4q tezsIowJckuGshj7bfvbU7/HeMlp4Uo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721716964; a=rsa-sha256; cv=none; b=KPJlE0ij2eY9dVQzTgnuikY9G3ndD4uMK+C/OEc9J5QVr/lM+Q3pm8EhOvMioy2HDFIE9l Xc6bW1FJtdOUyxfS5dZta2hsKzvM//CRu86qi5BKLMz4ZyLi/mySMnmOmAf5H6IFUO2Y60 SAkIAbsoI3pZtomzSqaT1L1Lq4pYleU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ODt+aK2h; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 8E6AACE0CF9; Tue, 23 Jul 2024 06:43:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7754C4AF09; Tue, 23 Jul 2024 06:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717006; bh=V+dgSsdkLeaynaNLrjIFS/zeTuKNf5COhGBjma8zEGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODt+aK2hntJ4K/DgO09RgcVQDVlgQib7Wv18s95VxuIsyiapHrjR7UpxaSrWvMh/B pj3Df2JE3Wp1haN0UUedtmKxV3QLcnwsj0QgyWl9r7C+gnNnLt38Yzqwv1j7beSwg5 aH2rb9R5eYKrpG2YqG8XS3aPxzV8glDHV5NMOCllzocifqXGs4uVkaHjHX768pSxWO Z25iFtRytazM4PcLalHwExjd1r6Tv/naAwgXnuZ5/yXhkY5HpR+cvHkuCkRX2imv3e +ecyEpCYd8FvvUZv/y821Qk4J0ZBS9qM1kFYRI+35C+c6GuPpt12bRmNQgnF1uSmwF vpeO54BCZmIOg== 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 06/25] MIPS: loongson64: drop HAVE_ARCH_NODEDATA_EXTENSION Date: Tue, 23 Jul 2024 09:41:37 +0300 Message-ID: <20240723064156.4009477-7-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-Stat-Signature: 5wtt9bnz61u81ut9n8rik9pu67tgztwf X-Rspamd-Queue-Id: 71903100003 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1721717010-558376 X-HE-Meta: U2FsdGVkX1+L2+9CorW83f7WVvKEHeIBsE48iSnbosbvIuUQQSJlNj0vSVkKp0/8+6CZaMtqRq4g9n4vIpPPy7gAc3kxvle0TLQ4TFG4cr3OjkH0YY+Ee7S+0/ahWLRGEQi4LU44AcZhNmYUwaCgCxLbE57XGnazarTgjtxsP2E/9ZYbrD7wezz9WozrpLjoW/cyt6xkDfvrs+XIGO4tQSyV9ZzqxHUVGUpd2kM2ICjROlBK4TSFXlnbsrKgGgaXNbHeAIXRV44F4XCMEzsZ1I5jzKGEVzWdmkoeuGKCUVgkMZ6WzI3AZX9NLRkvvD1Xjsc0BdQEx8ZZRFCzbSFg18bzWs3dibRfD3v6d6c1Q92bjBTmvCGJ5fEUYluuXC6AvUHhNEvpXYbSkVFu6i3hKe61BZU74rz/lt9C2SMEZeOJbjcIchFe6i2MZ8ZSixSUrRHB0ClJZ21SU5R4Qq1qc5rA87dLsJnc13w/B4JzmfZuzjKvFEwNAnnUpqpqKENT3hfQpHyQkchQFTcvYStKaVkeztfE1f19MtfSapjo+EjgUaLg0tF+FMVBgRGfPqDkEyI+6UIJMKcr2LJmyvP5X+g3cGpdmhs3rLRLF2g33Gl+sBdVHUDWbE4eJTMgFKyBcu7xxw7eknC+vYXzOr4fZiiH7edG98bS0wwReELFGnYokbUBIPi2ch/vVYbGjoFnncCqb4IF+XPLIKtf713wt2v/ZL09W93RUUkf80en2aXQIvDKryQpIi3iePxB6hOrJOJh1d6/saKry3Z0VaPnl7DLECdnbkeaywWKqgV4BdgjpViCXtcwGofDYgCQxGt2+YMJMvrLY1hqLVVJqYbjKTlO5TR9eaJOkvaWzr0H26eDyOu/cURsSh3bxUuKmADAQJhF7+prThAJwSr4QW8gzsWEKNBsL8pOkM62Bc06cCppW6b/ipY6VayURAEC0lR99XVL4UbRtuIdbYkSRp/ ETUzTAju TAc6IlknKJIaEJmgc2Gne9ryeZyhHW2tznPRsnmgmdUW/dcz6v3QYh5TDz4fDITo9unwdOPuCDg35L09N+fHHTOUp6elEW7rj9L1Xop6/o73wwUvK/AwnnzoWgeegSm+mqCx+j4ZPH5AnVX6sRHIuppBHeexbLYGBZqi/HKuyZ7K45OUOXnQNTjQc1oLL3CyF4sol1128RVDTuWXXNtlTXAVrhSVtdUhSC93oO71Cdfleg+MI9kNtsDywqRwXFoqMG5Hufus2958m4z3E4IYElepU3TLngo+3EFu2FAd8ElbeIK8yfLMuBKQtzXz+F9xKgLsM 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)" Commit f8f9f21c7848 ("MIPS: Fix build error for loongson64 and sgi-ip27") added HAVE_ARCH_NODEDATA_EXTENSION to loongson64 to silence a compilation error that happened because loongson64 didn't define array of pg_data_t as node_data like most other architectures did. After rename of __node_data to node_data arch_alloc_nodedata() and HAVE_ARCH_NODEDATA_EXTENSION can be dropped from loongson64. Since it was the only user of HAVE_ARCH_NODEDATA_EXTENSION config option also remove this option from arch/mips/Kconfig. Signed-off-by: Mike Rapoport (Microsoft) --- arch/mips/Kconfig | 4 ---- arch/mips/loongson64/numa.c | 10 ---------- 2 files changed, 14 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 954f12a9e669..8221e47457aa 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -501,7 +501,6 @@ config MACH_LOONGSON64 select USE_OF select BUILTIN_DTB select PCI_HOST_GENERIC - select HAVE_ARCH_NODEDATA_EXTENSION if NUMA help This enables the support of Loongson-2/3 family of machines. @@ -2608,9 +2607,6 @@ config NUMA config SYS_SUPPORTS_NUMA bool -config HAVE_ARCH_NODEDATA_EXTENSION - bool - config RELOCATABLE bool "Relocatable kernel" depends on SYS_SUPPORTS_RELOCATABLE diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c index b50ce28d2741..64fcfaa885b6 100644 --- a/arch/mips/loongson64/numa.c +++ b/arch/mips/loongson64/numa.c @@ -198,13 +198,3 @@ void __init prom_init_numa_memory(void) pr_info("CP0_PageGrain: CP0 5.1 (0x%x)\n", read_c0_pagegrain()); prom_meminit(); } - -pg_data_t * __init arch_alloc_nodedata(int nid) -{ - return memblock_alloc(sizeof(pg_data_t), SMP_CACHE_BYTES); -} - -void arch_refresh_nodedata(int nid, pg_data_t *pgdat) -{ - node_data[nid] = pgdat; -} 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); From patchwork Tue Jul 23 06:41:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739435 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 5BCAFC3DA63 for ; Tue, 23 Jul 2024 06:43:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF9546B009D; Tue, 23 Jul 2024 02:43:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD06B6B009E; Tue, 23 Jul 2024 02:43:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C71776B009F; Tue, 23 Jul 2024 02:43:56 -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 A59EB6B009D for ; Tue, 23 Jul 2024 02:43:56 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 504C4121BF8 for ; Tue, 23 Jul 2024 06:43:56 +0000 (UTC) X-FDA: 82370077272.07.696C425 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf16.hostedemail.com (Postfix) with ESMTP id 0880618000B for ; Tue, 23 Jul 2024 06:43:53 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZP+xdfEg; spf=pass (imf16.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717012; 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=P/2ECl+w0Zjyv+15rnAjmNLn+cpB8l59V0WFxOsYHeg=; b=j9YgAQtHXI22wpQdEjW7tTGVAZ5FzCdTwQaVgnsbwjGzMKTX0A+p/TM9tJ6am1iS5uNVfg ijxrvyJEzD6kowRFAkpvbjlBZhrNg+QduwqaypqNwrUHrtmxHRAl+bjCcuEo9kHLYYH5K4 WYJZ6ptf96XP1MSbPD1Tjk3MTDiBWkQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZP+xdfEg; spf=pass (imf16.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717012; a=rsa-sha256; cv=none; b=DL9FxOcSvND2yOfFrBrnNumk1w76n19N9KqiYCZrockUGl2u1KU1exnMWbKafqL88Han90 9O537B/irftSynGnuDpaIKYHaav790D6FyU4KqJWAz3fDPtwaWY+qL++J83N71hcLXrZEA PHwcItRszp1AT8URZxNCjWw0Q+DFjac= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E1884CE0C6D; Tue, 23 Jul 2024 06:43:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F270AC4AF0C; Tue, 23 Jul 2024 06:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717030; bh=3tLDf1A3Qqi7b0Tvewht7ITo1ix4u9lyILXU8PE7OyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZP+xdfEgnVkDeUMe/9VXsuMyklUt1RjwTVlbRJF51rDHm8AJBlbxPqq1nzkVFz4W7 DQMXFtFmYQN96MiC/SBmmfLAjGeocwUNhaDtsc6S4yvh5Ef32iknEAIlMVd1n3WUIV T4U21XrJ8XK4lg2jR+Xv8uvck408+9GsQFsePyi+u+Y0Uh4T+fMQRhznjYhnBS0ZHE VTKRDVzxlzg0b7JkdS8qRT9H7puoLZhxn3baAONxBEeF7u0GYwEqrJruTnwgdGt23B WGe/hqTjwO2N1wid/+SUKEjU07i5MFu6/mAn3TIJwDXglOmvcmn7DHW1fcPh8lh8g7 mxdzTDaZXkAYQ== 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, Jonathan Cameron Subject: [PATCH v2 08/25] arch, mm: move definition of node_data to generic code Date: Tue, 23 Jul 2024 09:41:39 +0300 Message-ID: <20240723064156.4009477-9-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-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0880618000B X-Stat-Signature: snqjez5dd74abs9i8no5rd5h7u64whhj X-HE-Tag: 1721717033-612072 X-HE-Meta: U2FsdGVkX18cuUgKc5WN+J9vCKbkWAzGslsc7VE76UI8yOdQkIFN/KFKTYI2Pt1ymKFhHpnBpqG4tXhdx8hHDbUp109d8qk+wD5zcmOHXYZV+okmXFy+47Ta7VKQ9+P+CN0mA89eiBDicc8CbDYsSJp3o3t5+Pat8K1ebx/F0wjYjbErznp24MPW+mg7ZuKix4uiJ8t7+nr56lf98F1OyNYKR5Nseb6++4noXQlqQBFN6eZAOaY9o0GCnbdZINn/D1DNKUVzbI/nAvy6DD+it2I2AAFt5bARLywlG06QWjNUrnoMpQxw4dZTZdE/FSDf5eAj+1Qv7LXjg6IkXfzoVu28O0Z0JnjFn5+d+1xE/AS7gt+OiYEEPEWw8fREK1BlPq8B4/34zOPfWqBKcz9/OgzJNOqqAJYSFsazoiOlz8pAjpPYpuNt31TqFuID3tBwdYrJPxKOXyqq6G8thZLqzc0OAbfyNYrezjsYtDuVrfpPGPKZFAxXgD01lp7uj3T6n/rCp1xGOLSwg6oujONej9Mmt37Nl16VpMPPbGJ+i5yO3Ab4wY7ZSkHb6bazzQ4ph9nCUaMRAPGQgoEAwWTAnIJy7X07UdRjOGECSjUGcCgsxhhTPyCHw05fr/d/yGotxcRCS0GS+gEq/RfFBGBexM8EeknG2CihWWtEdH8SoffhDpZpNbeWsF1FvxAz7MIxpsQ13bGE+rN7Jx6mpcnTR887i5jEIbq0azVt1eMLFxHEbVZs6i5Tyjow8xIH/rw0tqF/E1t6mLi50agCf1w3oW0Lrdvn3Gjt0R1x8yyLuFLrPshdho2dlLkx0P5slJF60+KAYMmBQFiZ3wV+EauyRV/R1Zl9YiaKpeXqKomU3NUJSGiiQ/98600MasTohzI3ibriD1o7Pj7rwB4Ducvkno0S1nMqUlkgGC/+zs7O2WZKN+ef1gZIBJpupT0pSJEv1ioyEcIIc5S97djMqNz jLjH/5HY PZKgs6AEslMoSHF9JGLb0GUADSIdMDu7i+InkTd1NqQ8F//9l1ljeY9CwOpvRkToOXi8iC7iODkf93E9shrEM1bp9M2kqALgw5tkTczjTfshsss//zDNEUj0lCCAgD8t07Ky6Af0r8ttrVJSl+w22zvOPLW+zmxhkDjNy+1m8GaihA0Eq5mvAThEAYktafiCpe1q/B9x/uhd3WEeBGMjqiCDMP9b2BJHeSpOf3BM9AvuzrGzV1BqJLewslDNkxLsd/V20YJKbq6Ozxh26CNqTgzRfTnuLQDY6bM14o0+NQMtpZDVTIwxvE/zjN8hiznYvLNXywYyQpKyx9RLFU/3g8qWnl/XxaFNVBSf5Zv4QubBE94T4RqotxHCrTmzUlMnsQ2jn9uNbd2y9LWz9aFYmD22fi2CXWSI9dxc2w8tLJUOyt5VXAaSqqoUFFQ64R+SXy5AjQfyCXDBN/WQ= 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)" Every architecture that supports NUMA defines node_data in the same way: struct pglist_data *node_data[MAX_NUMNODES]; No reason to keep multiple copies of this definition and its forward declarations, especially when such forward declaration is the only thing in include/asm/mmzone.h for many architectures. Add definition and declaration of node_data to generic code and drop architecture-specific versions. Signed-off-by: Mike Rapoport (Microsoft) Acked-by: David Hildenbrand Reviewed-by: Jonathan Cameron Acked-by: Davidlohr Bueso --- arch/arm64/include/asm/Kbuild | 1 + arch/arm64/include/asm/mmzone.h | 13 ------------- arch/arm64/include/asm/topology.h | 1 + arch/loongarch/include/asm/Kbuild | 1 + arch/loongarch/include/asm/mmzone.h | 16 ---------------- arch/loongarch/include/asm/topology.h | 1 + arch/loongarch/kernel/numa.c | 3 --- arch/mips/include/asm/mach-ip27/mmzone.h | 4 ---- arch/mips/include/asm/mach-loongson64/mmzone.h | 4 ---- arch/mips/loongson64/numa.c | 2 -- arch/mips/sgi-ip27/ip27-memory.c | 3 --- arch/powerpc/include/asm/mmzone.h | 6 ------ arch/powerpc/mm/numa.c | 2 -- arch/riscv/include/asm/Kbuild | 1 + arch/riscv/include/asm/mmzone.h | 13 ------------- arch/riscv/include/asm/topology.h | 4 ++++ arch/s390/include/asm/Kbuild | 1 + arch/s390/include/asm/mmzone.h | 17 ----------------- arch/s390/kernel/numa.c | 3 --- arch/sh/include/asm/mmzone.h | 3 --- arch/sh/mm/numa.c | 3 --- arch/sparc/include/asm/mmzone.h | 4 ---- arch/sparc/mm/init_64.c | 2 -- arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/mmzone.h | 6 ------ arch/x86/include/asm/mmzone_32.h | 17 ----------------- arch/x86/include/asm/mmzone_64.h | 18 ------------------ arch/x86/mm/numa.c | 3 --- drivers/base/arch_numa.c | 2 -- include/asm-generic/mmzone.h | 5 +++++ include/linux/numa.h | 3 +++ mm/numa.c | 3 +++ 32 files changed, 22 insertions(+), 144 deletions(-) delete mode 100644 arch/arm64/include/asm/mmzone.h delete mode 100644 arch/loongarch/include/asm/mmzone.h delete mode 100644 arch/riscv/include/asm/mmzone.h delete mode 100644 arch/s390/include/asm/mmzone.h delete mode 100644 arch/x86/include/asm/mmzone.h delete mode 100644 arch/x86/include/asm/mmzone_32.h delete mode 100644 arch/x86/include/asm/mmzone_64.h create mode 100644 include/asm-generic/mmzone.h diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index 4b6d2d52053e..4aaaa821ab6b 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 generic-y += early_ioremap.h generic-y += mcs_spinlock.h +generic-y += mmzone.h generic-y += qrwlock.h generic-y += qspinlock.h generic-y += parport.h diff --git a/arch/arm64/include/asm/mmzone.h b/arch/arm64/include/asm/mmzone.h deleted file mode 100644 index fa17e01d9ab2..000000000000 --- a/arch/arm64/include/asm/mmzone.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_MMZONE_H -#define __ASM_MMZONE_H - -#ifdef CONFIG_NUMA - -#include - -extern struct pglist_data *node_data[]; -#define NODE_DATA(nid) (node_data[(nid)]) - -#endif /* CONFIG_NUMA */ -#endif /* __ASM_MMZONE_H */ diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h index 0f6ef432fb84..5fc3af9f8f29 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -5,6 +5,7 @@ #include #ifdef CONFIG_NUMA +#include struct pci_bus; int pcibus_to_node(struct pci_bus *bus); diff --git a/arch/loongarch/include/asm/Kbuild b/arch/loongarch/include/asm/Kbuild index c862672ed953..2804f2a2ad61 100644 --- a/arch/loongarch/include/asm/Kbuild +++ b/arch/loongarch/include/asm/Kbuild @@ -15,6 +15,7 @@ generic-y += fcntl.h generic-y += ioctl.h generic-y += ioctls.h generic-y += mman.h +generic-y += mmzone.h generic-y += msgbuf.h generic-y += sembuf.h generic-y += shmbuf.h diff --git a/arch/loongarch/include/asm/mmzone.h b/arch/loongarch/include/asm/mmzone.h deleted file mode 100644 index 2b9a90727e19..000000000000 --- a/arch/loongarch/include/asm/mmzone.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Author: Huacai Chen (chenhuacai@loongson.cn) - * Copyright (C) 2020-2022 Loongson Technology Corporation Limited - */ -#ifndef _ASM_MMZONE_H_ -#define _ASM_MMZONE_H_ - -#include -#include - -extern struct pglist_data *node_data[]; - -#define NODE_DATA(nid) (node_data[(nid)]) - -#endif /* _ASM_MMZONE_H_ */ diff --git a/arch/loongarch/include/asm/topology.h b/arch/loongarch/include/asm/topology.h index 66128dec0bf6..50273c9187d0 100644 --- a/arch/loongarch/include/asm/topology.h +++ b/arch/loongarch/include/asm/topology.h @@ -8,6 +8,7 @@ #include #ifdef CONFIG_NUMA +#include extern cpumask_t cpus_on_node[]; diff --git a/arch/loongarch/kernel/numa.c b/arch/loongarch/kernel/numa.c index 8fe21f868f72..acada671e020 100644 --- a/arch/loongarch/kernel/numa.c +++ b/arch/loongarch/kernel/numa.c @@ -27,10 +27,7 @@ #include int numa_off; -struct pglist_data *node_data[MAX_NUMNODES]; unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES]; - -EXPORT_SYMBOL(node_data); EXPORT_SYMBOL(node_distances); static struct numa_meminfo numa_meminfo; diff --git a/arch/mips/include/asm/mach-ip27/mmzone.h b/arch/mips/include/asm/mach-ip27/mmzone.h index 629c3f290203..56959eb9cb26 100644 --- a/arch/mips/include/asm/mach-ip27/mmzone.h +++ b/arch/mips/include/asm/mach-ip27/mmzone.h @@ -24,8 +24,4 @@ extern struct node_data *__node_data[]; #define hub_data(n) (&__node_data[(n)]->hub) -extern struct pglist_data *node_data[]; - -#define NODE_DATA(nid) (node_data[nid]) - #endif /* _ASM_MACH_MMZONE_H */ diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h index 2effd5f8ed62..8fb70fd3c9c4 100644 --- a/arch/mips/include/asm/mach-loongson64/mmzone.h +++ b/arch/mips/include/asm/mach-loongson64/mmzone.h @@ -14,10 +14,6 @@ #define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT) #define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT) -extern struct pglist_data *node_data[]; - -#define NODE_DATA(n) (node_data[n]) - extern void __init prom_init_numa_memory(void); #endif /* _ASM_MACH_MMZONE_H */ diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c index 64fcfaa885b6..d56238745744 100644 --- a/arch/mips/loongson64/numa.c +++ b/arch/mips/loongson64/numa.c @@ -29,8 +29,6 @@ unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; EXPORT_SYMBOL(__node_distances); -struct pglist_data *node_data[MAX_NUMNODES]; -EXPORT_SYMBOL(node_data); cpumask_t __node_cpumask[MAX_NUMNODES]; EXPORT_SYMBOL(__node_cpumask); diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index eb6d2fa41a8a..1963313f55d8 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c @@ -34,9 +34,6 @@ #define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) #define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) -struct pglist_data *node_data[MAX_NUMNODES]; -EXPORT_SYMBOL(node_data); - struct node_data *__node_data[MAX_NUMNODES]; EXPORT_SYMBOL(__node_data); diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h index da827d2d0866..d99863cd6cde 100644 --- a/arch/powerpc/include/asm/mmzone.h +++ b/arch/powerpc/include/asm/mmzone.h @@ -20,12 +20,6 @@ #ifdef CONFIG_NUMA -extern struct pglist_data *node_data[]; -/* - * Return a pointer to the node data for node n. - */ -#define NODE_DATA(nid) (node_data[nid]) - /* * Following are specific to this numa platform. */ diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index a490724e84ad..8c18973cd71e 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -43,11 +43,9 @@ static char *cmdline __initdata; int numa_cpu_lookup_table[NR_CPUS]; cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; -struct pglist_data *node_data[MAX_NUMNODES]; EXPORT_SYMBOL(numa_cpu_lookup_table); EXPORT_SYMBOL(node_to_cpumask_map); -EXPORT_SYMBOL(node_data); static int primary_domain_index; static int n_mem_addr_cells, n_mem_size_cells; diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild index 504f8b7e72d4..e44f168f60fc 100644 --- a/arch/riscv/include/asm/Kbuild +++ b/arch/riscv/include/asm/Kbuild @@ -2,6 +2,7 @@ generic-y += early_ioremap.h generic-y += flat.h generic-y += kvm_para.h +generic-y += mmzone.h generic-y += parport.h generic-y += spinlock.h generic-y += spinlock_types.h diff --git a/arch/riscv/include/asm/mmzone.h b/arch/riscv/include/asm/mmzone.h deleted file mode 100644 index fa17e01d9ab2..000000000000 --- a/arch/riscv/include/asm/mmzone.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_MMZONE_H -#define __ASM_MMZONE_H - -#ifdef CONFIG_NUMA - -#include - -extern struct pglist_data *node_data[]; -#define NODE_DATA(nid) (node_data[(nid)]) - -#endif /* CONFIG_NUMA */ -#endif /* __ASM_MMZONE_H */ diff --git a/arch/riscv/include/asm/topology.h b/arch/riscv/include/asm/topology.h index 61183688bdd5..fe1a8bf6902d 100644 --- a/arch/riscv/include/asm/topology.h +++ b/arch/riscv/include/asm/topology.h @@ -4,6 +4,10 @@ #include +#ifdef CONFIG_NUMA +#include +#endif + /* Replace task scheduler's default frequency-invariant accounting */ #define arch_scale_freq_tick topology_scale_freq_tick #define arch_set_freq_scale topology_set_freq_scale diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild index 4b904110d27c..297bf7157968 100644 --- a/arch/s390/include/asm/Kbuild +++ b/arch/s390/include/asm/Kbuild @@ -7,3 +7,4 @@ generated-y += unistd_nr.h generic-y += asm-offsets.h generic-y += kvm_types.h generic-y += mcs_spinlock.h +generic-y += mmzone.h diff --git a/arch/s390/include/asm/mmzone.h b/arch/s390/include/asm/mmzone.h deleted file mode 100644 index 73e3e7c6976c..000000000000 --- a/arch/s390/include/asm/mmzone.h +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * NUMA support for s390 - * - * Copyright IBM Corp. 2015 - */ - -#ifndef _ASM_S390_MMZONE_H -#define _ASM_S390_MMZONE_H - -#ifdef CONFIG_NUMA - -extern struct pglist_data *node_data[]; -#define NODE_DATA(nid) (node_data[nid]) - -#endif /* CONFIG_NUMA */ -#endif /* _ASM_S390_MMZONE_H */ diff --git a/arch/s390/kernel/numa.c b/arch/s390/kernel/numa.c index 23ab9f02f278..ddc1448ea2e1 100644 --- a/arch/s390/kernel/numa.c +++ b/arch/s390/kernel/numa.c @@ -14,9 +14,6 @@ #include #include -struct pglist_data *node_data[MAX_NUMNODES]; -EXPORT_SYMBOL(node_data); - void __init numa_setup(void) { int nid; diff --git a/arch/sh/include/asm/mmzone.h b/arch/sh/include/asm/mmzone.h index 7b8dead2723d..63f88b465e39 100644 --- a/arch/sh/include/asm/mmzone.h +++ b/arch/sh/include/asm/mmzone.h @@ -5,9 +5,6 @@ #ifdef CONFIG_NUMA #include -extern struct pglist_data *node_data[]; -#define NODE_DATA(nid) (node_data[nid]) - static inline int pfn_to_nid(unsigned long pfn) { int nid; diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index 50f0dc1744d0..9bc212b5e762 100644 --- a/arch/sh/mm/numa.c +++ b/arch/sh/mm/numa.c @@ -14,9 +14,6 @@ #include #include -struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; -EXPORT_SYMBOL_GPL(node_data); - /* * On SH machines the conventional approach is to stash system RAM * in node 0, and other memory blocks in to node 1 and up, ordered by diff --git a/arch/sparc/include/asm/mmzone.h b/arch/sparc/include/asm/mmzone.h index a236d8aa893a..74eb2c71d077 100644 --- a/arch/sparc/include/asm/mmzone.h +++ b/arch/sparc/include/asm/mmzone.h @@ -6,10 +6,6 @@ #include -extern struct pglist_data *node_data[]; - -#define NODE_DATA(nid) (node_data[nid]) - extern int numa_cpu_lookup_table[]; extern cpumask_t numa_cpumask_lookup_table[]; diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 00b247d924a9..3cb698204609 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -1115,11 +1115,9 @@ static void init_node_masks_nonnuma(void) } #ifdef CONFIG_NUMA -struct pglist_data *node_data[MAX_NUMNODES]; EXPORT_SYMBOL(numa_cpu_lookup_table); EXPORT_SYMBOL(numa_cpumask_lookup_table); -EXPORT_SYMBOL(node_data); static int scan_pio_for_cfg_handle(struct mdesc_handle *md, u64 pio, u32 cfg_handle) diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild index a192bdea69e2..6c23d1661b17 100644 --- a/arch/x86/include/asm/Kbuild +++ b/arch/x86/include/asm/Kbuild @@ -11,3 +11,4 @@ generated-y += xen-hypercalls.h generic-y += early_ioremap.h generic-y += mcs_spinlock.h +generic-y += mmzone.h diff --git a/arch/x86/include/asm/mmzone.h b/arch/x86/include/asm/mmzone.h deleted file mode 100644 index c41b41edd691..000000000000 --- a/arch/x86/include/asm/mmzone.h +++ /dev/null @@ -1,6 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifdef CONFIG_X86_32 -# include -#else -# include -#endif diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h deleted file mode 100644 index 2d4515e8b7df..000000000000 --- a/arch/x86/include/asm/mmzone_32.h +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002 - * - */ - -#ifndef _ASM_X86_MMZONE_32_H -#define _ASM_X86_MMZONE_32_H - -#include - -#ifdef CONFIG_NUMA -extern struct pglist_data *node_data[]; -#define NODE_DATA(nid) (node_data[nid]) -#endif /* CONFIG_NUMA */ - -#endif /* _ASM_X86_MMZONE_32_H */ diff --git a/arch/x86/include/asm/mmzone_64.h b/arch/x86/include/asm/mmzone_64.h deleted file mode 100644 index 0c585046f744..000000000000 --- a/arch/x86/include/asm/mmzone_64.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* K8 NUMA support */ -/* Copyright 2002,2003 by Andi Kleen, SuSE Labs */ -/* 2.5 Version loosely based on the NUMAQ Code by Pat Gaughen. */ -#ifndef _ASM_X86_MMZONE_64_H -#define _ASM_X86_MMZONE_64_H - -#ifdef CONFIG_NUMA - -#include -#include - -extern struct pglist_data *node_data[]; - -#define NODE_DATA(nid) (node_data[nid]) - -#endif -#endif /* _ASM_X86_MMZONE_64_H */ diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 6ce10e3c6228..7de725d6bb05 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -24,9 +24,6 @@ int numa_off; nodemask_t numa_nodes_parsed __initdata; -struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; -EXPORT_SYMBOL(node_data); - static struct numa_meminfo numa_meminfo __initdata_or_meminfo; static struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index 5b59d133b6af..9b71ad2869f1 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -15,8 +15,6 @@ #include -struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; -EXPORT_SYMBOL(node_data); nodemask_t numa_nodes_parsed __initdata; static int cpu_to_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; diff --git a/include/asm-generic/mmzone.h b/include/asm-generic/mmzone.h new file mode 100644 index 000000000000..2ab5193e8394 --- /dev/null +++ b/include/asm-generic/mmzone.h @@ -0,0 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_MMZONE_H +#define _ASM_GENERIC_MMZONE_H + +#endif diff --git a/include/linux/numa.h b/include/linux/numa.h index eb19503604fe..e5841d4057ab 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h @@ -30,6 +30,9 @@ static inline bool numa_valid_node(int nid) #ifdef CONFIG_NUMA #include +extern struct pglist_data *node_data[]; +#define NODE_DATA(nid) (node_data[nid]) + /* Generic implementation available */ int numa_nearest_node(int node, unsigned int state); diff --git a/mm/numa.c b/mm/numa.c index 67ca6b8585c0..8c157d41c026 100644 --- a/mm/numa.c +++ b/mm/numa.c @@ -3,6 +3,9 @@ #include #include +struct pglist_data *node_data[MAX_NUMNODES]; +EXPORT_SYMBOL(node_data); + /* Stub functions: */ #ifndef memory_add_physaddr_to_nid From patchwork Tue Jul 23 06:41:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739436 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 0CAA5C3DA63 for ; Tue, 23 Jul 2024 06:44:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DAF16B009F; Tue, 23 Jul 2024 02:44:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98B0A6B00A0; Tue, 23 Jul 2024 02:44:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 853046B00A1; Tue, 23 Jul 2024 02:44:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 68C046B009F for ; Tue, 23 Jul 2024 02:44:08 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 30DD4161CC5 for ; Tue, 23 Jul 2024 06:44:08 +0000 (UTC) X-FDA: 82370077776.06.85B26A7 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf26.hostedemail.com (Postfix) with ESMTP id E11EF14000C for ; Tue, 23 Jul 2024 06:44:05 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=X7z8FkVA; spf=pass (imf26.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717023; 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=5aheRIiquoqzqsqnDsiFNNYl56CFrJ5NQ02aMR5EoKc=; b=fBy16K174PWDWd0Po9ktcf6X0Zh9IqPpZvZ1arZ3Gfd1obFWLwz058jLWlSg5IrHqD3/Fe SEsx/oLMnEUq+xUpkWsLaq1i/CuVjhNa28HlZaiVfYjoKZRZO14/TSYNCw00fPZentpdH9 g9hmiVuDVMLdSvlnq7Ch71MJAwDszZM= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=X7z8FkVA; spf=pass (imf26.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717023; a=rsa-sha256; cv=none; b=I4+a8wch1i9KJE+3+ubmCzoEIIsDI3oumpTaeD/iwU4abqmYsECBe/HYzWLp7L05wGBEwM xr2HHddzpWiuIHwUx9yWiZxMSZr7SDz7jv8+nCMEWLQqqK4uw0TPBfDbTuPWYVF10WJs89 gwiYktB4V1sVi7NdirkKV7gGxPQsQRE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id AB53BCE0B08; Tue, 23 Jul 2024 06:44:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCBF2C4AF10; Tue, 23 Jul 2024 06:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717042; bh=E3MX7Qldt9CVztVnkyappGTQ+vc6bjnaP687BSR8VLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X7z8FkVAZvIq78aouyUDmF3loPrwk9cNOmEJ2gIIHZpGHxyIUpocbZ0//nu0ZimcF 1QgaXrD4gQlbul+cGBBqg2ZTKuGaelnu2qImq5mDgJD0THJ3uEcrJ4svVthnl/ZFxb wkUJmzcRgJtL//h91gqwgqUa/fTtvdwrkYFbcuNhY3g6c1QJA70VTkqkLR/lQYmcfR U0S2Gbc2h/YllFpQ+9NlopoW49HgABSnB24aLJIOOB6rwqxIR5ZTnseo3rErr/C4TG RVlcP7H6O3G98HAsHpOSk/AfkTs55rvZQSsHz08VvcJirUh/H4uTey93ISBHc/F2Cv gZciC2ZdEz2RA== 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, Jonathan Cameron Subject: [PATCH v2 09/25] arch, mm: pull out allocation of NODE_DATA to generic code Date: Tue, 23 Jul 2024 09:41:40 +0300 Message-ID: <20240723064156.4009477-10-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: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: E11EF14000C X-Stat-Signature: kdaykgqsiq11w156dw5qy8m96xubb7c5 X-HE-Tag: 1721717045-790571 X-HE-Meta: U2FsdGVkX18G+jBFw8gC/XGO2BQjZkWDW+EyQqNPlBm6hgeOMZQQ8wlH7UYP2QkBHGzGY1OtkAoScB8PXiM3/ssw7YTSP6ZE/w3g2UIeY6kLCWb81wbCoH38jfClBTPbSBerI6ze6VRSgZNalUtsSeiYHAbPIgGI8AJMyDDWqTj1vBbr8CpbNbYxscjnQNtZk22MhiNtrHupsmV/KKSsc1W07yqyg+kODU1otMSDkUmCFlOmXlb+eETaDixhJZ+m6lHSPHcIGiOKH+SnV3AfS79gx5VQw6i2QLZsRwnzpUhfgNyLZwHHzqqbIILsXDeR60VpNOlgpF8jzP3KS9zsSxgwWzJ6R4L7/oFI+rpgbPotHAIRbJmbkX+UKaAJ6hIgcWLzTevYZseibRRY712F4GtKisiS09WGFlaSe+Xmbft+xeri24gvIOxGdDcykr+7edwWnCWa46ihLNsyUk+V9bURgN6AWwcY56hoAHm6pNNtJrN41M0sdPynGNi8mDSDAaw0Mhyc0JQgnpylwp3K+QppD1p48ZgeM/5BBtY8PFAc6+rkEfMv6L3LwMtu5aTqcnlkm2O72Hv19Q8XYzCH56OvRPxIwxTnfpw8x3bLzKpLgUcXLidgbmvRM1G0q1HDhlZeFsvPMc1cFCU5RHSbkU3j/6sv6yQ0BdO9TWy9aIqoYkaQ3Lqmgtq3HYxM6G8vGy4iiqVAirK0HcMso6GUw/pVU48OGajEQAdAtzb7A9zVaw0uTFZLZ764DA1X6LxnW8X1nNSQuSveKu+Jw/ljKb38KpIa/t90FCNjEzX3VYn85bqrMQZkM369X+vynjsA4EXD13vd6DUMbBGMTh02pqW+O+aukHbxRTg4EdjJNuE79eh2VDBPwHiYVeOQsh8OuREFfW04IthPbMC7/DvfLCTau/H1wFPYz3i5ULaDS10MsrdPN3Gmqf6DHSAC/fXBfDMMpjZQf8KyXt7in/g 20geeirK HB4clBVQ9JIochOvNFF3oE8tANxEUhSP/fqMDlc/ziG2MQIXRA7mJgaIGpS2H9jJ4QDsUfWZvUgY60etH5fGa7CWm41DgkmhJj/C4Og1+Jc0a9v2LwpgUMA/3ZhxvcC+HK6Az/5bT240UlsmRm5ao5kGqcjb2mORnCFksfhIX7QRQCo9FqN0+Msw8qpY34+5nM3j8TKswviB8+zOHeP83Ku1Tjs5JqT7hg/0XEhSL5hMaRXMYipGFs9PEOa4hki+z08RMInxFZjjdyPHsV7kRj3Vj9xtmFC6ZzdJp3BRXt8rKsLgj8TnQp5LvJxN+UzSW2+N6fOvUJobXSUyStISnNZi3gqsekvYL9K+Wq6fTJRp0oOO4TWC5KuOzrA== 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)" Architectures that support NUMA duplicate the code that allocates NODE_DATA on the node-local memory with slight variations in reporting of the addresses where the memory was allocated. Use x86 version as the basis for the generic alloc_node_data() function and call this function in architecture specific numa initialization. Round up node data size to SMP_CACHE_BYTES rather than to PAGE_SIZE like x86 used to do since the bootmem era when allocation granularity was PAGE_SIZE anyway. Signed-off-by: Mike Rapoport (Microsoft) Acked-by: David Hildenbrand Reviewed-by: Jonathan Cameron --- arch/loongarch/kernel/numa.c | 18 ------------------ arch/mips/loongson64/numa.c | 16 ++-------------- arch/powerpc/mm/numa.c | 24 +++--------------------- arch/sh/mm/init.c | 7 +------ arch/sparc/mm/init_64.c | 9 ++------- arch/x86/mm/numa.c | 34 +--------------------------------- drivers/base/arch_numa.c | 21 +-------------------- include/linux/numa.h | 2 ++ mm/numa.c | 27 +++++++++++++++++++++++++++ 9 files changed, 39 insertions(+), 119 deletions(-) diff --git a/arch/loongarch/kernel/numa.c b/arch/loongarch/kernel/numa.c index acada671e020..84fe7f854820 100644 --- a/arch/loongarch/kernel/numa.c +++ b/arch/loongarch/kernel/numa.c @@ -187,24 +187,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) return numa_add_memblk_to(nid, start, end, &numa_meminfo); } -static void __init alloc_node_data(int nid) -{ - void *nd; - unsigned long nd_pa; - size_t nd_sz = roundup(sizeof(pg_data_t), PAGE_SIZE); - - nd_pa = memblock_phys_alloc_try_nid(nd_sz, SMP_CACHE_BYTES, nid); - if (!nd_pa) { - pr_err("Cannot find %zu Byte for node_data (initial node: %d)\n", nd_sz, nid); - return; - } - - nd = __va(nd_pa); - - node_data[nid] = nd; - memset(nd, 0, sizeof(pg_data_t)); -} - static void __init node_mem_init(unsigned int node) { unsigned long start_pfn, end_pfn; diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c index d56238745744..8388400d052f 100644 --- a/arch/mips/loongson64/numa.c +++ b/arch/mips/loongson64/numa.c @@ -81,12 +81,8 @@ static void __init init_topology_matrix(void) static void __init node_mem_init(unsigned int node) { - struct pglist_data *nd; unsigned long node_addrspace_offset; unsigned long start_pfn, end_pfn; - unsigned long nd_pa; - int tnid; - const size_t nd_size = roundup(sizeof(pg_data_t), SMP_CACHE_BYTES); node_addrspace_offset = nid_to_addrbase(node); pr_info("Node%d's addrspace_offset is 0x%lx\n", @@ -96,16 +92,8 @@ static void __init node_mem_init(unsigned int node) pr_info("Node%d: start_pfn=0x%lx, end_pfn=0x%lx\n", node, start_pfn, end_pfn); - nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, node); - if (!nd_pa) - panic("Cannot allocate %zu bytes for node %d data\n", - nd_size, node); - nd = __va(nd_pa); - memset(nd, 0, sizeof(struct pglist_data)); - tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); - if (tnid != node) - pr_info("NODE_DATA(%d) on node %d\n", node, tnid); - node_data[node] = nd; + alloc_node_data(node); + NODE_DATA(node)->node_start_pfn = start_pfn; NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 8c18973cd71e..4c54764af160 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -1081,27 +1081,9 @@ void __init dump_numa_cpu_topology(void) static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) { u64 spanned_pages = end_pfn - start_pfn; - const size_t nd_size = roundup(sizeof(pg_data_t), SMP_CACHE_BYTES); - u64 nd_pa; - void *nd; - int tnid; - - nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid); - if (!nd_pa) - panic("Cannot allocate %zu bytes for node %d data\n", - nd_size, nid); - - nd = __va(nd_pa); - - /* report and initialize */ - pr_info(" NODE_DATA [mem %#010Lx-%#010Lx]\n", - nd_pa, nd_pa + nd_size - 1); - tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); - if (tnid != nid) - pr_info(" NODE_DATA(%d) on node %d\n", nid, tnid); - - node_data[nid] = nd; - memset(NODE_DATA(nid), 0, sizeof(pg_data_t)); + + alloc_node_data(nid); + NODE_DATA(nid)->node_id = nid; NODE_DATA(nid)->node_start_pfn = start_pfn; NODE_DATA(nid)->node_spanned_pages = spanned_pages; diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index bf1b54055316..5cc89a0932c3 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -212,12 +212,7 @@ void __init allocate_pgdat(unsigned int nid) get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); #ifdef CONFIG_NUMA - NODE_DATA(nid) = memblock_alloc_try_nid( - sizeof(struct pglist_data), - SMP_CACHE_BYTES, MEMBLOCK_LOW_LIMIT, - MEMBLOCK_ALLOC_ACCESSIBLE, nid); - if (!NODE_DATA(nid)) - panic("Can't allocate pgdat for node %d\n", nid); + alloc_node_data(nid); #endif NODE_DATA(nid)->node_start_pfn = start_pfn; diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 3cb698204609..83279c43572d 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -1075,14 +1075,9 @@ static void __init allocate_node_data(int nid) { struct pglist_data *p; unsigned long start_pfn, end_pfn; -#ifdef CONFIG_NUMA - NODE_DATA(nid) = memblock_alloc_node(sizeof(struct pglist_data), - SMP_CACHE_BYTES, nid); - if (!NODE_DATA(nid)) { - prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid); - prom_halt(); - } +#ifdef CONFIG_NUMA + alloc_node_data(nid); NODE_DATA(nid)->node_id = nid; #endif diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 7de725d6bb05..5e1dde26674b 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -191,39 +191,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) return numa_add_memblk_to(nid, start, end, &numa_meminfo); } -/* Allocate NODE_DATA for a node on the local memory */ -static void __init alloc_node_data(int nid) -{ - const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE); - u64 nd_pa; - void *nd; - int tnid; - - /* - * Allocate node data. Try node-local memory and then any node. - * Never allocate in DMA zone. - */ - nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid); - if (!nd_pa) { - pr_err("Cannot find %zu bytes in any node (initial node: %d)\n", - nd_size, nid); - return; - } - nd = __va(nd_pa); - - /* report and initialize */ - printk(KERN_INFO "NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid, - nd_pa, nd_pa + nd_size - 1); - tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); - if (tnid != nid) - printk(KERN_INFO " NODE_DATA(%d) on node %d\n", nid, tnid); - - node_data[nid] = nd; - memset(NODE_DATA(nid), 0, sizeof(pg_data_t)); - - node_set_online(nid); -} - /** * numa_cleanup_meminfo - Cleanup a numa_meminfo * @mi: numa_meminfo to clean up @@ -571,6 +538,7 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) continue; alloc_node_data(nid); + node_set_online(nid); } /* Dump memblock with node info and return. */ diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index 9b71ad2869f1..2ebf12eab99f 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -216,30 +216,11 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) */ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) { - const size_t nd_size = roundup(sizeof(pg_data_t), SMP_CACHE_BYTES); - u64 nd_pa; - void *nd; - int tnid; - if (start_pfn >= end_pfn) pr_info("Initmem setup node %d []\n", nid); - nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid); - if (!nd_pa) - panic("Cannot allocate %zu bytes for node %d data\n", - nd_size, nid); - - nd = __va(nd_pa); - - /* report and initialize */ - pr_info("NODE_DATA [mem %#010Lx-%#010Lx]\n", - nd_pa, nd_pa + nd_size - 1); - tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); - if (tnid != nid) - pr_info("NODE_DATA(%d) on node %d\n", nid, tnid); + alloc_node_data(nid); - node_data[nid] = nd; - memset(NODE_DATA(nid), 0, sizeof(pg_data_t)); NODE_DATA(nid)->node_id = nid; NODE_DATA(nid)->node_start_pfn = start_pfn; NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; diff --git a/include/linux/numa.h b/include/linux/numa.h index e5841d4057ab..3b12d8ca0afd 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h @@ -33,6 +33,8 @@ static inline bool numa_valid_node(int nid) extern struct pglist_data *node_data[]; #define NODE_DATA(nid) (node_data[nid]) +void __init alloc_node_data(int nid); + /* Generic implementation available */ int numa_nearest_node(int node, unsigned int state); diff --git a/mm/numa.c b/mm/numa.c index 8c157d41c026..67a0d7734a98 100644 --- a/mm/numa.c +++ b/mm/numa.c @@ -1,11 +1,38 @@ // SPDX-License-Identifier: GPL-2.0-or-later +#include #include #include struct pglist_data *node_data[MAX_NUMNODES]; EXPORT_SYMBOL(node_data); +/* Allocate NODE_DATA for a node on the local memory */ +void __init alloc_node_data(int nid) +{ + const size_t nd_size = roundup(sizeof(pg_data_t), SMP_CACHE_BYTES); + u64 nd_pa; + void *nd; + int tnid; + + /* Allocate node data. Try node-local memory and then any node. */ + nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid); + if (!nd_pa) + panic("Cannot allocate %zu bytes for node %d data\n", + nd_size, nid); + nd = __va(nd_pa); + + /* report and initialize */ + pr_info("NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid, + nd_pa, nd_pa + nd_size - 1); + tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); + if (tnid != nid) + pr_info(" NODE_DATA(%d) on node %d\n", nid, tnid); + + node_data[nid] = nd; + memset(NODE_DATA(nid), 0, sizeof(pg_data_t)); +} + /* Stub functions: */ #ifndef memory_add_physaddr_to_nid From patchwork Tue Jul 23 06:41:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739437 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 555AFC3DA63 for ; Tue, 23 Jul 2024 06:44:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D85F56B00A1; Tue, 23 Jul 2024 02:44:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D35646B00A2; Tue, 23 Jul 2024 02:44:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFC996B00A3; Tue, 23 Jul 2024 02:44:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A264B6B00A1 for ; Tue, 23 Jul 2024 02:44:16 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 51EB3C1C03 for ; Tue, 23 Jul 2024 06:44:16 +0000 (UTC) X-FDA: 82370078112.14.FAEF276 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id A6AB714000B for ; Tue, 23 Jul 2024 06:44:14 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DDQPEURu; spf=pass (imf09.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717008; 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=KdmVOEUYYLw3fo7FDdqHJYm3yN/WP9jqX/33lOGxZ0E=; b=48t++krPznHwUh34G9AKB2qjhBKAgScme8nztiqVnS8oP6ffDdwdxufuoee/IRnA/jkUkc FeCV8WgNqcwQtRs3AjFoUP7Cj7nrw+oCS7WivJ5tlPMPjNfhBpGIm589XYJUEOL486AMEM gHwOoaUdDt9x17eE4VdKcP+6OeNUnRE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717008; a=rsa-sha256; cv=none; b=EEEAOsEV+GkDDIXZ1Zt3ZOXGceLTydGq3BQbOAhtIHHg0vaAnQfGX7shKNpg2Ua1kkYNw1 I8PpblqSqro+wqXYa8Wa6zlacK8CsZVuQbbpEDZ8f3CzLm0i9b6tyfZxolxwDPGBZClocE 6MqU5HZJmDCos4ZSLwl6/UVI+my4G1g= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DDQPEURu; spf=pass (imf09.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id DA26460B89; Tue, 23 Jul 2024 06:44:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 893C4C4AF0C; Tue, 23 Jul 2024 06:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717053; bh=EH8wWBlMwsfXjtpnY4+zGDnJa6g8CExH9y2mEtavJgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DDQPEURuf/2youpPGfR9PjjP5vqWwzVt9eMvU1zvtUy1E8FR1p79NkbmM51BKspfd 8pPjpSZwbogFIC5obAc5U6evqQGBM5HUm6lxVwnbAc2y0V9AQLZvJrPIWQm3H2eDUc 0AfSs6duiMgIPOvoZ8jr4R6aW9CMtC2gm+/GLrYx+cHgiw6adzF0OS/0yTiaEKmYmh za6G0/Yrep1fQfHvALuhsHrvGHJ2rdPqnTHIGIUqj6QSFo41/n1Qco3z9vNXXkcwdU WlgTUrsz908dqxlqeUh9qqehWOyfDcAflFSCUd2WnY69Xee8sgqHsaJOe1Fv5ceY/y gEmEW190CPEBA== 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 10/25] x86/numa: simplify numa_distance allocation Date: Tue, 23 Jul 2024 09:41:41 +0300 Message-ID: <20240723064156.4009477-11-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-Stat-Signature: bpop96y4fr4m35yrm9t55gaep3y37of6 X-Rspamd-Queue-Id: A6AB714000B X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1721717054-462090 X-HE-Meta: U2FsdGVkX1++1Bd5GGJTYxKpU6QrLEKIZ2DVznjhxZWuOfi80PTSb7htjDacO+cNTlxzilVcBGqXQdBUV7ZVuBgaoJmz/cMSg6QqyvFBpQwwG2w4sp5IDwksWVfmNxNsmDH1DWXmNS3RN7qbZRdvFTl3M7pcZksjbihzdhHmoiNF1gr1UkyFmxGVKg8bXC4XQWkjg/U/sI9GHUi6jOAts1Tc1KGDsTdTEOBHNvgC0HGY0IVLBY8ZpJ3oPIbUTsVsFd+k4jL64WokfYPWmee00RhR4cR0G2UhL4jixqdj8NHUlO2/aGq3HfzNPGNLxXhenSySOTJ7pR+mDVPRyXemH4qsQPy48VEy0p34aMfzuig22HLHpOaB2CFZBI5K9Z4is0imQkR5S7BdagZkDOYWelV4F9S1bHKgqBLGj7H9KvIUCQwmDGdxxCSakJia7RpCFSR4PzNpXUYegU0ZzdT/9b7ZNzbKR7HDkup7y5yYTwlEEWr4XZpbO8EhaMUldeHxxyqbadT5H4FY2zxhOJoJoMoD1v4/fgSCyVwI7WZauB7mRIVznr7HRiEJyyHipV7HqJTZ9WtxJaPVVX9hNxYbdeBPo9O3sNIH9B1oDOoL7NGnRv+7gdJH6wtZNIgnforzFMRRC4cYsRmZ2HroliS616zDcyw/dUqyD+CEmKO3qrvGIzEC6r6TMtB0V3O2fMh/1SNy3vJv7O+fX/lfUgQYK8ZDd1YUKmJYkr0hDqVUGE6VDoxghW+srUpSBh7CW1MLU/acMUhg2gaCA5NPOesG1BcQDXYNv88zHnMziSvNoJt84ajW3/loH5mqTDIa0bdGZMgdBjGd58mcp/RKjUT730fq9MPj+9rsFC2g/vMW22YdKX4olnOIsVvXsGxjJNCjC++pjJho8cBQbxOto25l0+9eeuOxwONJ6lmPt028Fky2f8O/58l0t07UWzFeeHKlY2dG8Xo46W3Stxly/oh /vC0Pj46 dqqfKBIDaYfFgispNDRmpEDuS9dfb7wqVve1DZTSaxMOmquxriMo6RjXvU9/B2KHHFw8QgPUX5cJ7+rddzkW3ceBesO1zw/Mo2kkvlZnZp4WM9EaCO4yHDEQKgIl0shWk5eOOa9gJLLptYo9hT4KqIYbKCQ7+51GeXb7BiQEPcmbUbOf6F2nhNjBWlimWx08iZpk+Y57b1J1QZsDspyuFn9ve32TkBUwbSVXyVtJdPy5ztvYp1zqtwjFeQRZE2xNmnLszREtTYvxhmsPrVvFdfwUzlSo5TnqrUHvKdmwwbr9GtXfmY618LcjdjuDRMsv9FhcMyD50hs8mZvQ= 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)" Allocation of numa_distance uses memblock_phys_alloc_range() to limit allocation to be below the last mapped page. But NUMA initializaition runs after the direct map is populated and there is also code in setup_arch() that adjusts memblock limit to reflect how much memory is already mapped in the direct map. Simplify the allocation of numa_distance and use plain memblock_alloc(). Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/mm/numa.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 5e1dde26674b..edfc38803779 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -331,7 +331,6 @@ static int __init numa_alloc_distance(void) nodemask_t nodes_parsed; size_t size; int i, j, cnt = 0; - u64 phys; /* size the new table and allocate it */ nodes_parsed = numa_nodes_parsed; @@ -342,16 +341,14 @@ static int __init numa_alloc_distance(void) cnt++; size = cnt * cnt * sizeof(numa_distance[0]); - phys = memblock_phys_alloc_range(size, PAGE_SIZE, 0, - PFN_PHYS(max_pfn_mapped)); - if (!phys) { + numa_distance = memblock_alloc(size, PAGE_SIZE); + if (!numa_distance) { pr_warn("Warning: can't allocate distance table!\n"); /* don't retry until explicitly reset */ numa_distance = (void *)1LU; return -ENOMEM; } - numa_distance = __va(phys); numa_distance_cnt = cnt; /* fill with the default distances */ From patchwork Tue Jul 23 06:41:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739438 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 0C8DFC3DA49 for ; Tue, 23 Jul 2024 06:44:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 98CE76B00A3; Tue, 23 Jul 2024 02:44:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9161B6B00A4; Tue, 23 Jul 2024 02:44:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DDEC6B00A5; Tue, 23 Jul 2024 02:44:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5F9996B00A3 for ; Tue, 23 Jul 2024 02:44:28 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D52A01A1BC3 for ; Tue, 23 Jul 2024 06:44:27 +0000 (UTC) X-FDA: 82370078574.01.9B128C0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 35E40180013 for ; Tue, 23 Jul 2024 06:44:26 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Za5Jhcet; spf=pass (imf06.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717004; 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=FoQYEEaM/2pGl4HIwB4acUSi1dkmfnQuxsBB2KFemZ4=; b=ZJZKTkKZhFUCdCZWJxrPXiave2UyY2oBPDGsOlRQbSk5Gu0hfj7sneXngLV7HOZNxpoLRC Sh3RVtz9PNpytrTjj+4rQLk5FiLUKcKN4wUaEa36YwqRWhfNpjHs0C3dQce5otJxNPGUsh glEIkJqk+m4ad4CF/cwGixrgtQ12xGQ= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Za5Jhcet; spf=pass (imf06.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717004; a=rsa-sha256; cv=none; b=4ang7EYObXNZw5hAVBsx1xxCP0zxpHZTYIHCXd53UonTf36fGzVDed5UwgFQNHT0f5kV3l A0xp3fBxiZ1dj8vTirLUycGXGldlyEousL1qDydNqVMIlaG5S4JL2dNYAzr809vdQDQWTm numcn/d4LC8Cd8xzwn+eAmS9SI4vHFQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6D7D6601D7; Tue, 23 Jul 2024 06:44:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F62DC4AF09; Tue, 23 Jul 2024 06:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717065; bh=c6DgXq0zS+r3QhZ5flAVfEs4FfALF1+j15wi2hevr+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Za5JhcetTAfLRbJccTWeAUNIxgrg96br5y87BwWzZPLzZYM5IjOw4ndfZ4nIfWM9a 0kYpHEGaCq6sHARpYneu6wGWScDkDxMY9UcV7dpRLzFycumSP2BoGDaLlTOqcZLXTy MhVwp5rCs8e2OGmBS9+/Gn4wMTzHhc60AFxKa0ONJzfcOahicEDT4gok1reEmHY3m/ yJ8eHIgkq+6rm34FFaAF6eeeqrWyvK1zv4CjW5ghkagLShm8uJGUIM4w2FQQtbu2np +gfe1coXyBC8uzt0RQsU4ls3le21w36/2yCPFPHrBIKqMRwOZM2lnaFEnBfBxNNJvK Lhh8CDiwUIDtw== 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 11/25] x86/numa: use get_pfn_range_for_nid to verify that node spans memory Date: Tue, 23 Jul 2024 09:41:42 +0300 Message-ID: <20240723064156.4009477-12-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: rspam06 X-Rspamd-Queue-Id: 35E40180013 X-Stat-Signature: k78smnays6p5wguohitrdrckmo8osj6z X-Rspam-User: X-HE-Tag: 1721717066-733792 X-HE-Meta: U2FsdGVkX18fzzjA01k4t913xMb6UPrk/k1d2wYqw7MJt+hBQQBu9ludh6nx+7BTMV0mHO780cI3EBmRnw7za+8VPinaWTurIH4QQlYHe9kcQRpG3Rz0dv/kFEgQomfCK4POesUkNUqa+6AsIQjF6bc1eEnSvx2VO3838W1AnXLZNQ8zS7fZJ402nImijoQEmkhwIG+dkL/1DW3awDFPHOeb109dtk1zqoVETeA6WTAUDjS0NquJAiMCimAiXDmJuffVIxKLsoYTfU9JY/wieWRX2zVLPlEVpdyaGtJrgGOqYbz6zmplf1miH0yS40kMoKBBBfMto7oT3R7MQL0QFNTXqzbzr2sUByNZQPwcRBd/9QgQP/jsIGSmDd49Gc4yG7nPVUIicG73//eWPFa8p8UiN5baHSDZPesQzaQG8gwLC43nOCVSMlGuIbJhwFnHyPNQIfuAaG4NJdcNKCT3LkJpdQAHyoMom+2H5pcvvy7I3VlXvoIftxbKlw/41vhxee8LRMmB0o1Yd8DcNvbxh17X+6cS6ArblNyVe2pob4S2mtIE6/wjiDyoAPtEkdMDvMCSPvOA5IhwZgN34sGkJnLxzZNdroex2J9ZJBlent9Y3aiSKIkEvaZQxMNDqlP8yxn8jrBmfZ7MLSnYtwRPzzALyZlJa2WQT3AY+4KAyEkmoi/tggJwjbDnMFnk5qhkgns+MUc2kWsssVRuC/3QmYqLhDYNemMqmnw8EfVZ4LA+HtyBxU3nqt0IzulbUFhDFI3BhN5OnFZOYAfGVNzGBehyYFncf8v+1kuih5BioNLwn+WIR/vxkq3MKE7VlajkvAQb1PJKsSzCUxXFyfZ6UOe4h7xl/ZrAdj3PWvBE99ciHmy2MoKf5oP1+EXUCTzQarfiizheLgPGNNaf4tHznN00Ev4LlarH+cfCA6YyqTzmPa/boIOJ8ZMQmgx/+K7DrmyfAb38si1Dpp4P28m zbRzJ/2b vROZgirm9QLEdPcBrGIb8uQxYI7IP47pvkzb6oZzt+bfJ5eyGAjQQw7s0v2m6nJdUjlo6+tp57bqQAMW4oqRYuf7OQq2TKIKAyxmbtnhBFt/i/ceETk+rb0pU3JySX1wppuq9Vb6tK1DVNF5OCMah8nosamEmgjC03VGs2hM2kEC1zqEFnrCr4BUXolIOmv/TP8/LBES2RUO3IGsx5Y2435/jgAM2Vt0mTR1bWCwi5XS/7uhz0ChW4wDgExlu9vFVAu4kZZg2zB05GNGwEK2ZAgzhk2iZ2BbJ1CxSuXqqXBkzekKHgh9mdpGZnEkDoTiGMGlqzz36QP2TSbU= 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)" Instead of looping over numa_meminfo array to detect node's start and end addresses use get_pfn_range_for_init(). This is shorter and make it easier to lift numa_memblks to generic code. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/mm/numa.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index edfc38803779..cfe7e5477cf8 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -521,17 +521,10 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) /* Finally register nodes. */ for_each_node_mask(nid, node_possible_map) { - u64 start = PFN_PHYS(max_pfn); - u64 end = 0; + unsigned long start_pfn, end_pfn; - for (i = 0; i < mi->nr_blks; i++) { - if (nid != mi->blk[i].nid) - continue; - start = min(mi->blk[i].start, start); - end = max(mi->blk[i].end, end); - } - - if (start >= end) + get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); + if (start_pfn >= end_pfn) continue; alloc_node_data(nid); From patchwork Tue Jul 23 06:41:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739439 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 832B6C3DA63 for ; Tue, 23 Jul 2024 06:44:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 129E16B00A5; Tue, 23 Jul 2024 02:44:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B36C6B00A6; Tue, 23 Jul 2024 02:44:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E956D6B00A7; Tue, 23 Jul 2024 02:44:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C57A86B00A5 for ; Tue, 23 Jul 2024 02:44:42 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 847B01A1AEA for ; Tue, 23 Jul 2024 06:44:42 +0000 (UTC) X-FDA: 82370079204.23.1292D30 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf28.hostedemail.com (Postfix) with ESMTP id 3E60CC0004 for ; Tue, 23 Jul 2024 06:44:39 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DMH+LIu7; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717044; 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=f+JVIr9xEeM7sp1vfI+gj8t5P9Zrkmgh4No5kG8fOs8=; b=MQ9HdQWP3nPTnxrKmdxfTnT/zxudIMWzQWDnhCBsGvin2xwaQgV5ewI5EmOnEAw92u8xhy iXUdP4Q1qAPQLvbD3D8LAPua0qRUaqREDJaUfzA2Q2k64LxSPYbB2To/M8G+4bXbWxJrW/ Z6AJXveuMs95TKz53aMYHQtE8ohspUA= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DMH+LIu7; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717044; a=rsa-sha256; cv=none; b=To52XHhvmFI1TD16ACC09w2Ud+OLAK9hQBZXtZmT0E+hUzGRILVyEj+JOAAGIU4MjUPFHw yRIA+z+3cAYp7AzMhjnsXndxhFPDEnSaRbycjaK03Px2vjox9bg0CZbnM+p+OPRoRgNLUX eluEMd+DKuQGSa2wkmM4/XxR8zTiztk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 9B68FCE0CF9; Tue, 23 Jul 2024 06:44:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A897DC4AF11; Tue, 23 Jul 2024 06:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717076; bh=8rGMU6H0xpSW1PfNkpG5PW55rGb66bFUqmPdcr4x6rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMH+LIu7U+aon+ordBnOP9y/4e/JQcPrdrU4wjutvSLDDvXOc1ys6wuHbI4hKieQR /xgRhOakm6RQTdiw2VvUZ5E+G5+8InucFZSJ4L/WpYdF2KBpwnJhzL2X3blwUIsPHF BNsuUV6DrXa0kDav1NpSJD8RWtLixsQL95KrNLHU/bpdX+V8avSWLrtUxamv6XP6Ji Wy8f6yiSPuW67CGtqy45Wu7qsOcxty7IMCR7Ls2bWyZ9yB4JzsDY3BvA9clRGF07K6 TvjJ9DmJQksoZos1626QbyJJRVE6drznFrXoiqAYFhoYqZXLw0uPhlOK3FS/vUJ5rC SWsVGk9Lql1nw== 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, Jonathan Cameron Subject: [PATCH v2 12/25] x86/numa: move FAKE_NODE_* defines to numa_emu Date: Tue, 23 Jul 2024 09:41:43 +0300 Message-ID: <20240723064156.4009477-13-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-Stat-Signature: yx8wm18utomyp6d9rnq6xazatzez8ur5 X-Rspam-User: X-Rspamd-Queue-Id: 3E60CC0004 X-Rspamd-Server: rspam02 X-HE-Tag: 1721717079-811366 X-HE-Meta: U2FsdGVkX18/+DQe+sk9XNkEuSnd1awsCLxNS+e/D1c76krqoE3FD4csiv3gIkAdxIPyp6DcyVSaJy2idHj+gXF5K+ZJOmVzgVEHGZrfiF7n7ZWrk3LnizbaD/OQeiql0X5QEdCG+4YX3sAtnl5dBSufOheEvDUqDnVFCoyPkuXrW4IG5XHqOE1ErNZZW/sGgvtqGh4oQFciCf0qx9SJlualJsiDhtgr/vwDJtvj2DIQCzZ+nM2XWnNxlzHtca7fmehUaG4M8RD7vAKtnJ2HATXOUCapsUCvj5O3KhAtTtmZ4/UDKKoTrRbiYHK21OYF0/wzv6NX1DIm2W8XTv5Efe162mg4Yo1GCZHUFyqI1fCXFXUFBAIB+pMWFRDPSiglwZCoUt9mhOlZGMCPb3/WztwfYuiclTBGqcpt7rQP+4EaKYITEqCuJzHQp2XJYPmAA8/xq7JDljMNQQS58iTjQa0pwHDi7jKcnck2x32DHu7ub+yTiFB6Faz4Bd8i6HFPVzDU7YscCnI0BsUwg8z644DytXdBWJE19Dk6QdgsfPMLcE77wW9fUDBTe2YFEOQyc5eB9lm63yZIvY56rr9HKErX5WY35gWhOrUzzgX+FAb9zrXGuGmeQ71/iSmIX67pCfLq+oZfLy0pMT5AfirJyxswEEybKPlTRu0NKdwtgE9GvRg2H9wZv/6vU+kTKHo+8J+Qk+2xuoy/Mm/py8+iI0otXS3cBgcyDZCXFg/5WadOwSjrvSpkoFf8on+TiHi8S61Dk14SZ7O+cv5LCmEG6g8pVUd7wkiiA/Ph/W/gK+rB2BOnubpX2DwXhUbqjg4KizgS2B3CiI2Gi92Cdw5/ZbeMnF5VwGL0e95gjROQhQ0nCpq+ogfWogDU0Vx/Et8PMiHMRbaNy9oN2Gx2xtnGkOASEGhtCCNBVDirCnVVbCRGSFfSD7Ya5XnqZWNZgQSA0MDG9fv5X+7HKpQ19yH 6M+xV43y 5v4Br23IXJrdQn1O4iWMzQSmWTG7youmdqSMUUwmeVsFoc/nmB1OrJ3QxclatvCVndmLjJeOotAVXxi15LCjIasSyNrTGn3stwb1Ozoz2p+vW4xoeD9fxKe5a9fLt1itytj+e8WyJpBu0zTKR64bSwdY1aiLlgcXB2h1EqKdd0JWYF/aTnEcjjr0WnnIdFDwI1M4UHkI/TR+pTStwaM6ef6XlZ7He2q6I661Tr64RpGADITboyL3rK9Ei0l6mtdCu2vzcnlJqU95FLZ5alqKItJHXBWvI9BF1xDiy/DCJ2PUzYwoRF8QaVF6sPMYzJck04YCNK6XoA4WzpLGeGRkMFbdNKJjbC0pUj7CY 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)" The definitions of FAKE_NODE_MIN_SIZE and FAKE_NODE_MIN_HASH_MASK are only used by numa emulation code, make them local to arch/x86/mm/numa_emulation.c Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 2 -- arch/x86/mm/numa_emulation.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index ef2844d69173..2dab1ada96cf 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -71,8 +71,6 @@ void debug_cpumask_set_cpu(int cpu, int node, bool enable); #endif #ifdef CONFIG_NUMA_EMU -#define FAKE_NODE_MIN_SIZE ((u64)32 << 20) -#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) int numa_emu_cmdline(char *str); #else /* CONFIG_NUMA_EMU */ static inline int numa_emu_cmdline(char *str) diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 9a9305367fdd..1ce22e315b80 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -10,6 +10,9 @@ #include "numa_internal.h" +#define FAKE_NODE_MIN_SIZE ((u64)32 << 20) +#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) + static int emu_nid_to_phys[MAX_NUMNODES]; static char *emu_cmdline __initdata; From patchwork Tue Jul 23 06:41:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739441 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 82E0FC3DA64 for ; Tue, 23 Jul 2024 06:44:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04C6E6B00A8; Tue, 23 Jul 2024 02:44:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE2F26B00A9; Tue, 23 Jul 2024 02:44:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D36CE6B00AB; Tue, 23 Jul 2024 02:44:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id ABAA16B00A8 for ; Tue, 23 Jul 2024 02:44:51 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6FC7BA1C02 for ; Tue, 23 Jul 2024 06:44:51 +0000 (UTC) X-FDA: 82370079582.27.F4CD556 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id C6E251A0015 for ; Tue, 23 Jul 2024 06:44:49 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=j35xuHfu; spf=pass (imf19.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717043; 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=SKzJTyfBuLEO+RbNYtNDNeoVis+E0Bai8DJiVv+H23E=; b=TyJT40nPMBEO74CUlfMB5U8Ylrzg/rZpHXtsVUuo4pHkPcVRB2aIzw8BXKFjWaVmdbO3Bd GA0yor+fLbzOSSMNpGw/5+XaDSfSYn8RRVbYVttTkNHvHN77yoEl4gxbFhjxhbm2TrCp4B awwqmyiZmrcXNrIqBQsePaN01+73qUY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717043; a=rsa-sha256; cv=none; b=N/JoZC8L7h80vpeNzUCtbsnTUxXJdNF5tmRJ5ux/6Bhdtd+6RrLK8+Cn7yf2Pjo6jno+IX 0qKmNHXzvraw1IezJgMbfa2qnX+t3DlnRTAHrkhgNOGzlt2FMzpsVNOwPXoCfiB6hZ+baP KGMM1cIUr0C0fsAkJe+OcolFa7GVwfo= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=j35xuHfu; spf=pass (imf19.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0702460B90; Tue, 23 Jul 2024 06:44:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75DE2C4AF0C; Tue, 23 Jul 2024 06:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717088; bh=UMRR3QRNDoHU23r5jw2deXNa43lw6nj2o1uMl8WO5EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j35xuHfuNJnQeqb7veAbB9mttyDh+negQYCVoPrqp5oqP0zJLv/BXespI7J//nCIr Sc5hLZUbxIz7818WwGcqoz5uRApIPm6FTsS8D2xgtV/3QhZq/vSHjbyYQFteCdX9J/ Z0Q1q+EAiONG8IXS2KIYvn9ZTZrI3rN/ZDXZYtg5Ba0JDP5j1rydPiw07EDLRjnfzj pgm5ToFUGkUK44WCFFrLfRGFLEUz96+/NIboNOkbTCMEuxXkQqulA5vFQFBYRFoA+V bDUooind5lcDC0gKC+UTC2cNByUYBIjZr44sdbkDnMkyVdXJiz8oVeerB9hf/6EipM zivkL/l1N+MSA== 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, Jonathan Cameron Subject: [PATCH v2 13/25] x86/numa_emu: simplify allocation of phys_dist Date: Tue, 23 Jul 2024 09:41:44 +0300 Message-ID: <20240723064156.4009477-14-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C6E251A0015 X-Stat-Signature: gd5r1ct3grjzak31hy4y1f1egkmi53xq X-HE-Tag: 1721717089-108662 X-HE-Meta: U2FsdGVkX1/bME2K9h7sU/JDOKh43rGevsCDrBtIAPALhR4qbW5EPY1VEoiU9tjo2wNcyjOzdIhZsn+z5btU1tEefYjCbl9gkT7FMYN29DAbja3DlBWhtxfimxoKzmAPPQApB/U8xdltRJ4G1SjIzptAgEpedLfkVIUZRG9tClcB+Ers/N2kyOQ4v3/HY3k7BQf736wxouREQuwCnNwrAqGVVfYPvX5hNL6UbQHd6A1Uks0WjWVNosrrTnmXYN4bStuIo/RUSCG/ej+ux/QyVHpdHGqIo7lEFmdPqjNdu3okCmS34FJjOx5WJOd13amkYXb2UDX6gOkzFk97BQ+bXHtDyVqcv04444t6dnPQajzxVAKamLFLmuGzpMJuBH4JR5tj4aiTh04G2MBWD0pPLi0goVjt+WKOX/bv10Ctp4oWHikvxlqYsR/Qkt3N80N/lUDwwU8qwzmJcqZj3hVtQIEd+12eA79Clh2b9vavS2e3lIPG9zSbX2NBh5Cvu6QrrqJ0lvNmPdFWCAeXRdPBSaPLqJ0a3t1frddoUy960GpE8fNWdhFJJ2WDK0+0kbvf0EfH29Y+E++/CQMXCjNlCvL5Fd+rwpfd/OOiNh4AQwoR7FkeYK6iErNyMpX0Di2bsHQEoCEDoi57CdwYgIuCjbBG/Kcyr0xtCC5TenAtaAJQTjRc6W5MEVfZIy9X0LXhJMQoCvpzlc4bcGF8cFBTQ0DS39EwhtXSdnydUQMB+sxXbQSemoJUwMtD2aFTHw26qcFB2U0iSOy934x0OntaGFjY/c6dQHgRH5C/DzmmEJ4g5jS65lzRG1WQl3zdE+yNNKrhLKQAwSoi8GB1PUwri77v/tPO3+xjwe1xieID5dHOlKbBvVXb9XoEK2LDqQpER2F6fOXkjP9AsHEAYff4sY948RKqH7a5blTpO4si5GN1HETk2OJEZesXCzVg8Pk6W6YJ7cxGizJjuMUVvgx dAdiEyPz fZcFYKA5kZjlyoXnOINuQAra0TvEJ20/J7gcXhapXZ7oZ5p1NM/+NRQV/stGLJqcP2Q6IVWxBQi6C8T7NqRarTlrYHqquAHwhRCXYX/bZ31zb/bCJ1tMwqUlir8LIVcmW3I6dKfpB3H5QIMSn33QP1vzmIenq+KJb/bH+h954O/2H+H29vJqP8xdW9As3E9+/GcK58wnpe8RawRtpfg+OItWdY25XKMvMnQyKQstWxlpJfOfhpaOY/OWvuichFq7U0u+UIKsGjH0WjrHfh5nC4nojkwSX+LezsShrKCmpQfzXRGlCwUKmLJNmQMp07utSz1en1yi/dn60beMHkM7scFCS4uBz55laG6uZ 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)" By the time numa_emulation() is called, all physical memory is already mapped in the direct map and there is no need to define limits for memblock allocation. Replace memblock_phys_alloc_range() with memblock_alloc(). Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/mm/numa_emulation.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 1ce22e315b80..439804e21962 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -448,15 +448,11 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) /* copy the physical distance table */ if (numa_dist_cnt) { - u64 phys; - - phys = memblock_phys_alloc_range(phys_size, PAGE_SIZE, 0, - PFN_PHYS(max_pfn_mapped)); - if (!phys) { + phys_dist = memblock_alloc(phys_size, PAGE_SIZE); + if (!phys_dist) { pr_warn("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n"); goto no_emu; } - phys_dist = __va(phys); for (i = 0; i < numa_dist_cnt; i++) for (j = 0; j < numa_dist_cnt; j++) From patchwork Tue Jul 23 06:41:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739442 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 23CCEC3DA63 for ; Tue, 23 Jul 2024 06:45:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A06416B0085; Tue, 23 Jul 2024 02:45:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98BF26B00AC; Tue, 23 Jul 2024 02:45:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DF276B00AD; Tue, 23 Jul 2024 02:45:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5AEB46B0085 for ; Tue, 23 Jul 2024 02:45:03 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 25542A1C54 for ; Tue, 23 Jul 2024 06:45:03 +0000 (UTC) X-FDA: 82370080086.03.A1844DB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 6AC8914002F for ; Tue, 23 Jul 2024 06:45:01 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="NVxK/dES"; spf=pass (imf09.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717078; 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=2p09vV4kyjAbjfcBRTwBuWazo0Z2nK08XGTBaQ/j8Q4=; b=rutKnvF2+GztCWMkOr0qeuIyu9PhhHRQ7cNsdNEF7QkbYgReADf2LzfnZAy/CJwKM/+yp/ cepxD8mFPD/YWKRybTHAxY1d9WCtrmJfdTsLDZ0qzXTuosvuk2jAsrEM9IK3fUYL7cuv2J 5zsTlIjTnudisaQI0dgYXEaFmuIVGWA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="NVxK/dES"; spf=pass (imf09.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717078; a=rsa-sha256; cv=none; b=iOYREZUGtPIU4+vRtLK2cNUPDkjowYxHTbfU/6cdfrpfZHO9fALNnfxcBtqQb6nsUXFJBx iMjtCSPk3de7bcrtRVoYmwCG3he2ETYk752BYD0ePwlvHM/q5B2kzwltiTjQIsbyffdJp4 zenNjontE69u9VStSRrODViN/FyiHsY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A967360B98; Tue, 23 Jul 2024 06:45:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41369C4AF0B; Tue, 23 Jul 2024 06:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717100; bh=YsRpIjHui/E4Nyhzc91eYVtJPXNfygPjzJVhFxfItC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NVxK/dESWkZTLqLMzH+QJWFfHzOuDB5Zg9jxVFrm55l8etkE62sOi/PKgAV8Do0QY 9rqjDpdBneIIs6hLXbaC9H5ardG4k9hNSS/24b9JnxWSwubCihG79QaFgLXjiOt26i p5kfVp+usEUs2GaoIHsD2Gg+yWKdMTm1ax+yF74qZvG4LhsUAIfWXOI8A0pzR+4k2C 4L30n/ESR2jhEAg8I5Cgx9nuBQXnCjuKDvQSU/NlgeR8s9cl3adIfhZnMK/jclT8fC sCU2WFhWD8J2tFeo6YMWlMfyl6EZSdgTeivf6nLJX9D94/RMTIzVb5nPxrBdMYvlet +qODh3gpzSY0w== 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, Jonathan Cameron Subject: [PATCH v2 14/25] x86/numa_emu: split __apicid_to_node update to a helper function Date: Tue, 23 Jul 2024 09:41:45 +0300 Message-ID: <20240723064156.4009477-15-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: rspam11 X-Rspamd-Queue-Id: 6AC8914002F X-Stat-Signature: rqwxrfmc4dk1e68hd61xuqhhcxf1hckk X-Rspam-User: X-HE-Tag: 1721717101-304877 X-HE-Meta: U2FsdGVkX19eT7YgM2YzciVpCnLDJyuznzQLDr98qjOnsw3ESlIKA4l5q11k0rguX34w0hAhL44M6MSY6dPnfVn9Ke4ZCITsmhm81X+GgzezxRC/nQt73gk8MHy5IRGy09snbol5y4/7uSt2Yf0A8QNANm78LfWhlWoEAKv9lDcX+oeYT+jgOl4T7qnFf4YJojFvp4tAwZRJmQdF1J0WdupLz0t6I3Zl1QYPg/1t+37oNuxyEByuOFe4QN1BN8Y2inKp77/WPZ98zRI+d1Gh1LzzUP1D9Y0//GXKSrGaj1IiAn8vdgc2OMN9+6qkGpFuhpj+5uC0NMkfFwZ2zmcepPD3sIkYDtlDk0y0j9FDUuflx4nq1SxJX/gaB2yIeoOzM+uZf7QoiBvao+X/M5y8Y/j80Zj4OPtQ4phUMeP4sQikZI/m70QP3Ft4tK9eHnVp+xmixSTxeZ1NsYnlOG7T/o4EVg2UeAUar9k1TtwVMh8OIxoFnVeV6c05j4e/vcnAifIWKDKYV/JnX+iNMuy5CY6mxAxCqFL4zrdxRtGLs3TJD76CwiX6Q7FaXyGx9GLUSaYa3TFZa2/ib+ui63NkDEmQMJRuiupaYJSx5qZ5RBip/k6Dxh6F0I3Qgb+Yrairit2FngMmqUXD/a7oSIa9ezGTCdcXDdD0fjtdpYMCwxuSWx3PSzTqcaQEbSiqmk3SbZIuZPyAYA9zsXfgpYt8Ws21J/ckmUEvUJaVspk6T7QUUqYi0wxKypTNEeEP3LjUg86cwh2kxrp4OZMNZokk46Q31zBGqqnC3JsLPkjk2/PCPRM3y6zCY6LEcs5DXGgQo4FrdSytqb2B/LqUGuLlOU+yXaOOQfh2kJ8E4HIF061ojw1yKvBGmy/rjjgLF7FQoEVTSt1fXGxTOtf5x4C5kqWZ96hUJE1Bd876tdrdqEP/5qaS2bXMpk4kKXPfiTHg0VyYrU6QKTdsEkhcx3V MaqdFxzf lEsf11XrO7RIyD9l5gHtVoVLaHQ8PWP1mLVHMpE4GscMkNOkXHL5p5z0H1CNevcxJxPG56qWBIgwFWLUGSPSbmuZ6oBDJDcsK2DojRsMY2QHPAuFycWfb8GXQoaPuwmjgPYb/qZjFXDXGpfSlAAnGQIwoYevCBUAt0kTYHiTUoDaZ2UefOUArJzJ7QcsaDvKpc3AzBGhV9d6bon6ftri63RQNA7Vv9LenFJRL8q4+zAtvYH0rz4IMW9wE+AmLWG8WOBMx3yz/wD1iwcwmIhE/nQdNaZ+zDX+Ju71qGD/1dEoB3kIK9Mr1El/ciISoCO2t1DPGKvhfc9LL0JrdFInq4M6KNGdHNZt99BQD 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)" This is required to make numa emulation code architecture independent so that it can be moved to generic code in following commits. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 2 ++ arch/x86/mm/numa.c | 22 ++++++++++++++++++++++ arch/x86/mm/numa_emulation.c | 14 +------------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index 2dab1ada96cf..7017d540894a 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -72,6 +72,8 @@ void debug_cpumask_set_cpu(int cpu, int node, bool enable); #ifdef CONFIG_NUMA_EMU int numa_emu_cmdline(char *str); +void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys, + unsigned int nr_emu_nids); #else /* CONFIG_NUMA_EMU */ static inline int numa_emu_cmdline(char *str) { diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index cfe7e5477cf8..9180d524cfe4 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -848,6 +848,28 @@ EXPORT_SYMBOL(cpumask_of_node); #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ +#ifdef CONFIG_NUMA_EMU +void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys, + unsigned int nr_emu_nids) +{ + int i, j; + + /* + * Transform __apicid_to_node table to use emulated nids by + * reverse-mapping phys_nid. The maps should always exist but fall + * back to zero just in case. + */ + for (i = 0; i < ARRAY_SIZE(__apicid_to_node); i++) { + if (__apicid_to_node[i] == NUMA_NO_NODE) + continue; + for (j = 0; j < nr_emu_nids; j++) + if (__apicid_to_node[i] == emu_nid_to_phys[j]) + break; + __apicid_to_node[i] = j < nr_emu_nids ? j : 0; + } +} +#endif /* CONFIG_NUMA_EMU */ + #ifdef CONFIG_NUMA_KEEP_MEMINFO static int meminfo_to_nid(struct numa_meminfo *mi, u64 start) { diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 439804e21962..f2746e52ab93 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -476,19 +476,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) ei.blk[i].nid != NUMA_NO_NODE) node_set(ei.blk[i].nid, numa_nodes_parsed); - /* - * Transform __apicid_to_node table to use emulated nids by - * reverse-mapping phys_nid. The maps should always exist but fall - * back to zero just in case. - */ - for (i = 0; i < ARRAY_SIZE(__apicid_to_node); i++) { - if (__apicid_to_node[i] == NUMA_NO_NODE) - continue; - for (j = 0; j < ARRAY_SIZE(emu_nid_to_phys); j++) - if (__apicid_to_node[i] == emu_nid_to_phys[j]) - break; - __apicid_to_node[i] = j < ARRAY_SIZE(emu_nid_to_phys) ? j : 0; - } + numa_emu_update_cpu_to_node(emu_nid_to_phys, ARRAY_SIZE(emu_nid_to_phys)); /* make sure all emulated nodes are mapped to a physical node */ for (i = 0; i < ARRAY_SIZE(emu_nid_to_phys); i++) From patchwork Tue Jul 23 06:41:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739443 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 F3AF1C3DA49 for ; Tue, 23 Jul 2024 06:45:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 855A96B00AE; Tue, 23 Jul 2024 02:45:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DE846B00AF; Tue, 23 Jul 2024 02:45:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 631666B00B0; Tue, 23 Jul 2024 02:45:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3ED6F6B00AE for ; Tue, 23 Jul 2024 02:45:15 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F0E2AA5AA5 for ; Tue, 23 Jul 2024 06:45:14 +0000 (UTC) X-FDA: 82370080548.21.E800F2D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 5237E1C001F for ; Tue, 23 Jul 2024 06:45:13 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sy8Le62C; spf=pass (imf18.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717090; a=rsa-sha256; cv=none; b=UifULmNHgoORf6ysRJ6kVj/LUFhiYAotX5OcPJRumht7QNk/K6dFO9IgLHGeWb3SO+l2wl nBzDsZQ7rDyXxAG58h1NOSWR2GkHT1lNmgXbdTCkFRGPypFOtOQdFdm6sakww1Ee3DvewE uyEFns0sqQEI3Eo4NCFVfPwwEfcvQZQ= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sy8Le62C; spf=pass (imf18.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717090; 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=2EmLMS5bC2gO+A4kRuSt5h5bNKzXmA/Er2Ig9EwWhxU=; b=tizgb2zu1+k7A2d5kyXl8EnfdqL/C4bcQrKJCtJ1Y2kM55rxJ++fS+8INTVb0cY4AshjU/ vD3UhskBicdFbYcyT7z5ceuTJ7xeUfpCLhi4n8aB3dB0rs/tHSSgDDN8ArQpTfM7TGUep/ i8vrg6mejif4OplL6aSVdwMlPHyxo0I= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 91FD260D2C; Tue, 23 Jul 2024 06:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BD2FC4AF09; Tue, 23 Jul 2024 06:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717112; bh=NBS9sSELyDjXskLupWw1+sILSG3bb7AMsfQy1q7g6+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sy8Le62C0nSfYONzB5OqQtNVljQMOYCPxcj7s7rvy33s/FViYPWZhd2aXVmEOcluJ u5vJVlIgA5Z4zITDTVOT7CGOd5Rsl3raVSCCorRFuqlBEfq6cETpxEcJwIEoZrNJGw NMy+YX46uk98KS2sWFmufuZU03pF+oo+7txOWNcvH8ragojRdlr1a+5eEVnj1Mhi6B fl3/Err2rFg8lRV6hnME3wQhyBWGHzcxR9qZMxsOLF5GpdHxF/6i460+2L+cwghg+Q ZihtUIdEY4Bbh6svDmFpTm9x6NPbCucKFfd1WWOViYNGNL79W3VYlty98npK9T9rtA HoIXU79EZnyfg== 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, Jonathan Cameron Subject: [PATCH v2 15/25] x86/numa_emu: use a helper function to get MAX_DMA32_PFN Date: Tue, 23 Jul 2024 09:41:46 +0300 Message-ID: <20240723064156.4009477-16-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-Stat-Signature: 69odf5rb5kri6qb65sndonpwe4ihoopn X-Rspamd-Queue-Id: 5237E1C001F X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1721717113-8290 X-HE-Meta: U2FsdGVkX19stZHrEZESgCsEl9I68CmevPW/aSukCfGlKPo4HcEMihVzzlka9VtaLga6288QfRqalvH5CO/GW+dq/AN35liquq/s8x6ZkQxDVi0vfW4WrgDf3gGE+IsQ+8ztmboDEtdpYfc0oyevaSQm/blvfX7MPLSSmh+CIQjT2y3m04TQFQ24U+xyrE0i1Gy1ftebUMN1ZpyJ4fYnFOfAI59phD+k/2yTJCH4prFTjBebI3HVUnBWWkGsTNXu2owRwbfOfJLIcwKKxzz9SZStMdHpM64YYHmLjYopITylqrsEnPS7N7MV8zUTNDcm9E+tlCgD98cVpuhMAimCff7gidpJMTJ9L0BJIUxIyYl8VOkTIeQlY103oEfWvV6wOqJjhAb//XjYPJdLyRPVgsNDid7RgqE2kbfZg6vA/P1G3GQSl9eBU4eyR540LF2Jrtbz1ifoPEOMVMk/OFYQWCDW8U/eoBpLOmhuk4uspcK/PIP+Ucmznx9yVJ8zKGj56rDI0geTPHTDN0NtdBtERtJtloQPr6dGMnf8meb+sy7QOyjX83htCenj2K5buOW/5gqM1dFnc2gQVu+FkZBk8KOl2sGSpG7rHwOPKBwTZdgu5wQ1tNlr5G8BfmWvP8k/0BEnP34Pk5QRum9smyDFbZ+hAuPAGepLX9Io6iHFKdtXYK6aU8Ztsb6drk141RS31RyuWUadKBuYlfWVRmMp10o5LvP52Na8hxfWPeoe2toZEcJKb4+Jrv3UM7B8pxor9WN1i+QaRIxZSTvH67ygbDIpwiDL7rv5oOUd2dQ3AtGPLjEKx94ZtETCrbKkqsj45wZs77JkXuM7nsS3xSgPK37Tf0fe2kBu6Fyu81vewP/t9KwVvRAtQbjxE7Idf1+LPT4cSuGgNxMaKeWtzWGzvdtJeT5NWMU50FiZbqctpKYFg6v1mSqgy7fVAmfUQJyiMRZh4Iu11AQ03pVt0oJ uElBoyHd V8cG8vc4tL4YSjQHb4W0bNv4uNQca0Dr4f8gM0Mw9Il4HSgk1HdeYUNS7RoS3sGIxMmQAlTd5LOFAiuBvfoeT1GVEaYZvNG+99o5OhKwR2c19H+IB8L4Vef6UksBiA0QPjnh0cdRopQuX6PqCEzTlzQ47EFd8oMIqh3LlPLedGZ1xVeGemxWsTWF0d7EqQnf6p8aofC/cSXSEKumhXj6gSLviJjBnrS7jJiFaADB1FKnfUj+EnYnlrK7z/eOS8pq/eT15rINegKTbiJvfweg9XpH1XFojAhOm+itMFF+gvkNE457iYBTXFoHNEZCJVKroIfjwAPKGxs0h+qKYRTFLe4eKMmoCFibu9T+r 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)" This is required to make numa emulation code architecture independent so that it can be moved to generic code in following commits. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 1 + arch/x86/mm/numa.c | 5 +++++ arch/x86/mm/numa_emulation.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index 7017d540894a..b22c85c1ef18 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -74,6 +74,7 @@ void debug_cpumask_set_cpu(int cpu, int node, bool enable); int numa_emu_cmdline(char *str); void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys, unsigned int nr_emu_nids); +u64 __init numa_emu_dma_end(void); #else /* CONFIG_NUMA_EMU */ static inline int numa_emu_cmdline(char *str) { diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 9180d524cfe4..8b7c6580d268 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -868,6 +868,11 @@ void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys, __apicid_to_node[i] = j < nr_emu_nids ? j : 0; } } + +u64 __init numa_emu_dma_end(void) +{ + return PFN_PHYS(MAX_DMA32_PFN); +} #endif /* CONFIG_NUMA_EMU */ #ifdef CONFIG_NUMA_KEEP_MEMINFO diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index f2746e52ab93..fb4814497446 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -128,7 +128,7 @@ static int __init split_nodes_interleave(struct numa_meminfo *ei, */ while (!nodes_empty(physnode_mask)) { for_each_node_mask(i, physnode_mask) { - u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN); + u64 dma32_end = numa_emu_dma_end(); u64 start, limit, end; int phys_blk; @@ -275,7 +275,7 @@ static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei, */ while (!nodes_empty(physnode_mask)) { for_each_node_mask(i, physnode_mask) { - u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN); + u64 dma32_end = numa_emu_dma_end(); u64 start, limit, end; int phys_blk; From patchwork Tue Jul 23 06:41:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739444 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 02F53C3DA63 for ; Tue, 23 Jul 2024 06:45:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 856746B00AA; Tue, 23 Jul 2024 02:45:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DF3D6B00AF; Tue, 23 Jul 2024 02:45:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 659536B00B1; Tue, 23 Jul 2024 02:45:30 -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 433AA6B00AA for ; Tue, 23 Jul 2024 02:45:30 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ED91C1A1B11 for ; Tue, 23 Jul 2024 06:45:29 +0000 (UTC) X-FDA: 82370081178.27.27095D3 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf12.hostedemail.com (Postfix) with ESMTP id 8D7EB40023 for ; Tue, 23 Jul 2024 06:45:27 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sJMN+k7p; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.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=1721717076; 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=OjNQgrN6REz6c9/9GZCtVK4ZXG8FOeXjLqwyGqxjeVY=; b=U5IpTQsGoEaSvXxiw++EzUktV8BqPALx0nGg4t5vxGjbq/MIbLeQeAhnfQ/GicKxqUuIky co5EZxpuyrr+2WaizShCVGY+QaHSgdE7J7jQluMuRNbMM9stGi/sVqa6sxFJNkXny9402Z oLrb8ObWbylbxxEZeL92ZM/e5e75PMk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717076; a=rsa-sha256; cv=none; b=wQxI2zMm3URon84f+cmr2U88dVsmDcuBv54S65pW7yhE2RJsascdSLO/vXFgQU4KUxUYWH GN6LDGJwSWioO+T5/GDNtHN8zaDn8oJfW6loGorzPsId/MvD1GkeDBErxeAE5EBHKfyLRR P7eC2SIqPXDV6kwf0iSdn/1/5LZzjHk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sJMN+k7p; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.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 BA02FCE0C45; Tue, 23 Jul 2024 06:45:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA842C4AF0C; Tue, 23 Jul 2024 06:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717124; bh=pNYfU5nbHx/fmG089PdPYGa3502wUyTtzM4zHrG8Mvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sJMN+k7pUNhxKMGnIuCjgZTlPbUXg5/os1ykrILC9mUEWtB/1tafJrHYsT3Lzg6CC KxPlE4rLwAsWg/jKdXOabKO5hifhNh89+1FGJQUF+HuswOt6jRskwY16gaVvWcjg/u JaaAiOp6hsF6GNf1J4jgCi5e4XLZRTtF48K7QOEb7BcTzzyd78BuVnpn+3nEetKgQf pE/iZ00OiDD3XHUDQouzidclYaIdyKCfhkVnZGJn2HO5Ygy861wCszx7RSgDBl462P a5O5umZhDFqU4hwmQ7pIFqaYYCMo9SUyHpQy8O0yggfld3P/JTN0RCi+SHOyn2AaAG hdaJ2RE8Lgb/g== 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, Jonathan Cameron Subject: [PATCH v2 16/25] x86/numa: numa_{add,remove}_cpu: make cpu parameter unsigned Date: Tue, 23 Jul 2024 09:41:47 +0300 Message-ID: <20240723064156.4009477-17-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: 8D7EB40023 X-Stat-Signature: ghpownoko4nmf51i5p5713hwbmc14okm X-Rspam-User: X-HE-Tag: 1721717127-89422 X-HE-Meta: U2FsdGVkX18COnDnu0IUA3JnNIl7R1e+NpSYb3Giv83SMPVhdZpukDt+uovt+DxJyCgPpI/4WL1rKSCFvfJGKLcBKDgi/4hNZHv6jTHM5WwEXuxDSv4MmOBUU201wzrn9OOF2C4XCPbgIHQnV8rQNOGVIYmyRfPP88WPlPY/RH2OhsilkVu1O5VCNiftUMjqxe1DNB/wh1SbvBTRFKh5E5vW3Bpv/jaCrD66g0CPHpsBCZlgUcyj0Gpzll+z0HSPAlGkfB2yYfVV82iRo83J33yNQT7MK/i8ifpf/LTD3khY3LrryTYIrGXzVH6edYG3KQGFuvTNtaiqFgnVPDE5CgU/Gr+BT5T/25QxF/Dd53oqF+n6oekXvxYZUzUTVuNT//j91IvdBvGXyMzbKPiSQirl3QqxhD/LaOu4ldKxT/EG8C50n/U7cYpAOl+jGK3xx0nhryIHp9WurHATD7SMoIIbvbgeeWu9nTOky7VjPqGvn8yZiZ5Nq0ZqxniFw0Sg0lV2KUH1h66D0ewrZEni5rpbd09ZzK2mtksa9sGdxZfKAGXgN2l5aHcJoOwNR8IB4vmBR/5ttUqPo1thyd0VI3s4j2hjO/o3+8f9qNxkJwx5vW1ATndy29CQ088Des7ucflU67LbUZ9CeQfwjTGZbjM/SY/prb/wJsv8LglmaVH6sDw26MXRBVb1rjBzgn2U90Zf+DnjtYvY3L7Gide23PdvKLApH1WZ9qjoUf5fHMqpKZ9RYTGQXOXqeKQuZomw/ROF9zhWMKDo/N+FqxVhPh3qEMfelmLgBlpQeAND/RPb5uHyQ4PXLt44ilgqz1jw4c6Zx+dyaPracuKq+i/vspF0hQCrGO0lnTezL26P6DGI+nBFCO1gv8PnDfHl2CsBPE9X1yAK3C+y/srsqDbaWl5vW9cvF3RwCYCqQJwDt5jkrbas+foJjNp4EvDzbQNEPKKsZ5Bw70cU0EVGG/o I4jBf4ez iN7+aYO7OywKwtWA91loIrdCjmgvBZqk/bnwjhbGtQyTiVjTqQCyLXSX8qR/yN9lI3UaWx60qhnykKKY4b2zQngmfqUksMPo+mhyg+kVTeDKAEFu0Xy9mKVO7MxI+I/O0WfAIarhcFFaRtVaKYv7QmeUja0UglfRlWTKpf9KPleatXQ0Vv46Q0i4TvX4n2+drjlfRzEop2VA1wdokE3oo2nMJ4FCGisDkGOJqDRtrOPE4TtggHmDDY/MdNoJ/eO1L7awSTneWPcB+Vdbeds5UZx8DdsVj/tc9o1VSo1w3ENhXmlyRotXyAEvVISFOTrNYInW6TQIt9CFVpIRnEIYBG4y/0G/kBbow9f43 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)" CPU id cannot be negative. Making it unsigned also aligns with declarations in include/asm-generic/numa.h used by arm64 and riscv and allows sharing numa emulation code with these architectures. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 10 +++++----- arch/x86/mm/numa.c | 10 +++++----- arch/x86/mm/numa_emulation.c | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index b22c85c1ef18..6fa5ea925aac 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -54,20 +54,20 @@ static inline int numa_cpu_node(int cpu) extern void numa_set_node(int cpu, int node); extern void numa_clear_node(int cpu); extern void __init init_cpu_to_node(void); -extern void numa_add_cpu(int cpu); -extern void numa_remove_cpu(int cpu); +extern void numa_add_cpu(unsigned int cpu); +extern void numa_remove_cpu(unsigned int cpu); extern void init_gi_nodes(void); #else /* CONFIG_NUMA */ static inline void numa_set_node(int cpu, int node) { } static inline void numa_clear_node(int cpu) { } static inline void init_cpu_to_node(void) { } -static inline void numa_add_cpu(int cpu) { } -static inline void numa_remove_cpu(int cpu) { } +static inline void numa_add_cpu(unsigned int cpu) { } +static inline void numa_remove_cpu(unsigned int cpu) { } static inline void init_gi_nodes(void) { } #endif /* CONFIG_NUMA */ #ifdef CONFIG_DEBUG_PER_CPU_MAPS -void debug_cpumask_set_cpu(int cpu, int node, bool enable); +void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable); #endif #ifdef CONFIG_NUMA_EMU diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 8b7c6580d268..cf7b95125d2a 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -737,12 +737,12 @@ void __init init_cpu_to_node(void) #ifndef CONFIG_DEBUG_PER_CPU_MAPS # ifndef CONFIG_NUMA_EMU -void numa_add_cpu(int cpu) +void numa_add_cpu(unsigned int cpu) { cpumask_set_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); } -void numa_remove_cpu(int cpu) +void numa_remove_cpu(unsigned int cpu) { cpumask_clear_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); } @@ -780,7 +780,7 @@ int early_cpu_to_node(int cpu) return per_cpu(x86_cpu_to_node_map, cpu); } -void debug_cpumask_set_cpu(int cpu, int node, bool enable) +void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable) { struct cpumask *mask; @@ -812,12 +812,12 @@ static void numa_set_cpumask(int cpu, bool enable) debug_cpumask_set_cpu(cpu, early_cpu_to_node(cpu), enable); } -void numa_add_cpu(int cpu) +void numa_add_cpu(unsigned int cpu) { numa_set_cpumask(cpu, true); } -void numa_remove_cpu(int cpu) +void numa_remove_cpu(unsigned int cpu) { numa_set_cpumask(cpu, false); } diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index fb4814497446..235f8a4eb2fa 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -514,7 +514,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) } #ifndef CONFIG_DEBUG_PER_CPU_MAPS -void numa_add_cpu(int cpu) +void numa_add_cpu(unsigned int cpu) { int physnid, nid; @@ -532,7 +532,7 @@ void numa_add_cpu(int cpu) cpumask_set_cpu(cpu, node_to_cpumask_map[nid]); } -void numa_remove_cpu(int cpu) +void numa_remove_cpu(unsigned int cpu) { int i; @@ -540,7 +540,7 @@ void numa_remove_cpu(int cpu) cpumask_clear_cpu(cpu, node_to_cpumask_map[i]); } #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ -static void numa_set_cpumask(int cpu, bool enable) +static void numa_set_cpumask(unsigned int cpu, bool enable) { int nid, physnid; @@ -560,12 +560,12 @@ static void numa_set_cpumask(int cpu, bool enable) } } -void numa_add_cpu(int cpu) +void numa_add_cpu(unsigned int cpu) { numa_set_cpumask(cpu, true); } -void numa_remove_cpu(int cpu) +void numa_remove_cpu(unsigned int cpu) { numa_set_cpumask(cpu, false); } From patchwork Tue Jul 23 06:41:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739445 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 CF17EC3DA63 for ; Tue, 23 Jul 2024 06:45:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60C1E6B00A0; Tue, 23 Jul 2024 02:45:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 597C56B00AF; Tue, 23 Jul 2024 02:45:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3759E6B00B2; Tue, 23 Jul 2024 02:45:39 -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 0DEC86B00A0 for ; Tue, 23 Jul 2024 02:45:39 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C4FC11C4060 for ; Tue, 23 Jul 2024 06:45:38 +0000 (UTC) X-FDA: 82370081556.09.89A2619 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 193E240016 for ; Tue, 23 Jul 2024 06:45:36 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=n3HMCfkI; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.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=1721717085; 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=Jl+VykvF69NT+TKvxipTqvNJry0xlKe3M4FCy8gf4dU=; b=xE89ijTCoRiccnH6GeS9StcT+pqlcvLvaBqGfm8DVJy+zoTdZQ+sCv81TBBOXBP5Abt64G SyP+eIRFP+bM9cPrfa+7cTDBp++ezqeWe6BcCSea/+R5GqtGUyKHFmbPp2W2Oz2f7mAVtu ZG0zYrVR6fSx/bWL9R0iNPPA/4mxam0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717085; a=rsa-sha256; cv=none; b=Sq3+rG5as1uXj3r3hcJMgFEpDsamzn5jncfNqnnZpp5ArJcBKL93lf+XHqC7Q3dfwpHPI/ 7bo6rKrp9I7NgFCg/S6wz5LcY21n15Cuaw7axmkEWWiQpzubwVCI7My7A1P1fQe0Nshuge Tbh0rG5weSfeghDiO3TIcmXdIsMW5aU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=n3HMCfkI; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.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 28F8C60A23; Tue, 23 Jul 2024 06:45:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 971FBC4AF11; Tue, 23 Jul 2024 06:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717135; bh=+SS+kBMesJ55WKe6egUFmgElS27y1BsvfZiWIBsrKDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3HMCfkIDYgCAdmaqzZirn25m5YCUeyx2+Yt3KdJ6dTe+hC6ma8FVwdGgTevrbpTL V//8S9aE/BnndgxKBfH8v2teL/zytgKLeZ2En2ll04NA+2vnSnRelqp8J/Fc7zmU3u N2YmBf/L2IxONH8YSjWtlPNG2JSUVmrkq/CcYSl2x/7B7gxvE3wGy2UBHd60A2YUFK teggemL4n51lCoSdDB/KK9I/AbKJbXmmMIJ7lg2NBd5Le4xuGf9of21zn3SflH013v pdSEe26Djqlgk2Q3FaJEqaax7RJgiB4I5DBw/NKtOXnzTM+Lp3LjUZbxQa1YIgGrif lMfTVrQ9TgE3g== 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 17/25] mm: introduce numa_memblks Date: Tue, 23 Jul 2024 09:41:48 +0300 Message-ID: <20240723064156.4009477-18-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: 193E240016 X-Stat-Signature: iwxmi4abbk9kwzk986cxhzkosbcd9juq X-Rspam-User: X-HE-Tag: 1721717136-388888 X-HE-Meta: U2FsdGVkX19a/b3oz7dcmmoKY6Qo8Y0MdKCwjCv98XMhCxPiKp8grd/hXe0qJKqNARYQYsltnqLKlAJhWdG+C5YFR9f8OL/WctYX57hF8eZ2QR1WFk8w22WKVkB8KilW3YNCqIrwyJ9SDAaAeZDOMZ6WoksWVMbgvQXFtTQTwAJ8nOf76Kins1r9TkQHh3cBQc/bFqyCvGbTiUwdvMvuXH4/iJDuj0wAzxLCrUNWE7J7NUdBwbNAoiae3DITHYt1SXsNQhMBecptfkDzq592BQ76j3qw91qKV0Agpd7LOnqFXfGBRxZC9AUBCCoFlCNRZJucQgPkPVbe0IjQEbP+Rez20rh426O/XiNXtexRKV49n632Ew2xYsTUwlDYAIiudN0NbIFLXWARXKPgVQRV2tChkZB/Qg57R05Nt5yyBK0Hg2ATVo9pQLqvfwAtH7Nl2NbtR7o59c233n11qtpDfuLTWJv9kAep9Sn0gSatGIiACa9FC4aGlyZsWWTbgNpuv1PVo6jna+s3h6y8EHLVZYKIE3KVldl8IoDUWHSftt1hEpV/fgs8vtc3ZqxVjIvcMouiwxBdHKZvjkCiBkjXltOO+bONFDhoNLJL0j6TxgbJWR623L/N1p/tTGlLe2pHMYvO/EGNS2QGz/KrIU7wEpVV5WnJ3tQ1hOTxqTMvGEvqWA2jjAF6wjuu2seOCoF3TM3uo5xFXUyaLmBtmvlwPenY1rhLYggdZphTKpgEeegHl7fEbnIP8XB8lYsIeaw/SOSfirgQR1+9MOKO5gBdaCoUhfsVt4DkofF06DpG5CyOAcF0pYwtj/DVjq1r0VWwRz2RYTfGXgy6owss+B5C52WQvbVZjeGRf0qsEwCCkm8wxeyxUUUjA+CUXjFYu7V7yMcEAfRFs581eRo77TVvWId32msFvLzMLCgY6a16khTbjHE6f3AS81eVdPranNU8wVIUAurfzU6FlzhbbvE dpweYNuZ 0buFTH5PbY8kBhHt4uDKr217NUk//1DL7PHUum4Nb1VUCynOv81QOAKny0E3L9hcSu9ZeYWt1jIBJkI8AavuJNfrqU0qII3TK3z8Tk1Ebewyo7WO+Nfervm/Uo3z4wOn9gbkONY4NAYaTWaNtrZx82KY9SdwxiC2BRROQ/G4f0cfPAnHUROllv9Ti5kFf6ScZG/hlki2cZ5oAq/CTkwrknbWH0lMHJJMGHKN8O2KoRbA7JtrUDge04jB5fhrNovP/yeeGnhkfeW2oQC41jkFrAAo1w/6sjlZahCZeGZ8Ie+OruTHRdwwzU3gHhh7dlq/+NXTfeXalbnGNcJsiSsxSgAqTh8jm1Gm6iI0W3mel3EQJOTA= 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)" Move code dealing with numa_memblks from arch/x86 to mm/ and add Kconfig options to let x86 select it in its Kconfig. This code will be later reused by arch_numa. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/Kconfig | 1 + arch/x86/include/asm/numa.h | 3 - arch/x86/mm/amdtopology.c | 1 + arch/x86/mm/numa.c | 372 +-------------------------------- arch/x86/mm/numa_emulation.c | 1 + arch/x86/mm/numa_internal.h | 15 +- drivers/acpi/numa/srat.c | 1 + drivers/of/of_numa.c | 1 + include/linux/numa_memblks.h | 35 ++++ mm/Kconfig | 3 + mm/Makefile | 1 + mm/numa_memblks.c | 385 +++++++++++++++++++++++++++++++++++ 12 files changed, 436 insertions(+), 383 deletions(-) create mode 100644 include/linux/numa_memblks.h create mode 100644 mm/numa_memblks.c diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1d7122a1883e..d8084f37157c 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -295,6 +295,7 @@ config X86 select NEED_PER_CPU_EMBED_FIRST_CHUNK select NEED_PER_CPU_PAGE_FIRST_CHUNK select NEED_SG_DMA_LENGTH + select NUMA_MEMBLKS if NUMA select PCI_DOMAINS if PCI select PCI_LOCKLESS_CONFIG if PCI select PERF_EVENTS diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index 6fa5ea925aac..6e9a50bf03d4 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -10,8 +10,6 @@ #ifdef CONFIG_NUMA -#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) - extern int numa_off; /* @@ -25,7 +23,6 @@ extern int numa_off; extern s16 __apicid_to_node[MAX_LOCAL_APIC]; extern nodemask_t numa_nodes_parsed __initdata; -extern int __init numa_add_memblk(int nodeid, u64 start, u64 end); extern void __init numa_set_distance(int from, int to, int distance); static inline void set_apicid_to_node(int apicid, s16 node) diff --git a/arch/x86/mm/amdtopology.c b/arch/x86/mm/amdtopology.c index 9332b36a1091..628833afee37 100644 --- a/arch/x86/mm/amdtopology.c +++ b/arch/x86/mm/amdtopology.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index cf7b95125d2a..6874d5650b4d 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -22,10 +23,6 @@ #include "numa_internal.h" int numa_off; -nodemask_t numa_nodes_parsed __initdata; - -static struct numa_meminfo numa_meminfo __initdata_or_meminfo; -static struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; static int numa_distance_cnt; static u8 *numa_distance; @@ -121,194 +118,6 @@ void __init setup_node_to_cpumask_map(void) pr_debug("Node to cpumask map for %u nodes\n", nr_node_ids); } -static int __init numa_add_memblk_to(int nid, u64 start, u64 end, - struct numa_meminfo *mi) -{ - /* ignore zero length blks */ - if (start == end) - return 0; - - /* whine about and ignore invalid blks */ - if (start > end || nid < 0 || nid >= MAX_NUMNODES) { - pr_warn("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n", - nid, start, end - 1); - return 0; - } - - if (mi->nr_blks >= NR_NODE_MEMBLKS) { - pr_err("too many memblk ranges\n"); - return -EINVAL; - } - - mi->blk[mi->nr_blks].start = start; - mi->blk[mi->nr_blks].end = end; - mi->blk[mi->nr_blks].nid = nid; - mi->nr_blks++; - return 0; -} - -/** - * numa_remove_memblk_from - Remove one numa_memblk from a numa_meminfo - * @idx: Index of memblk to remove - * @mi: numa_meminfo to remove memblk from - * - * Remove @idx'th numa_memblk from @mi by shifting @mi->blk[] and - * decrementing @mi->nr_blks. - */ -void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi) -{ - mi->nr_blks--; - memmove(&mi->blk[idx], &mi->blk[idx + 1], - (mi->nr_blks - idx) * sizeof(mi->blk[0])); -} - -/** - * numa_move_tail_memblk - Move a numa_memblk from one numa_meminfo to another - * @dst: numa_meminfo to append block to - * @idx: Index of memblk to remove - * @src: numa_meminfo to remove memblk from - */ -static void __init numa_move_tail_memblk(struct numa_meminfo *dst, int idx, - struct numa_meminfo *src) -{ - dst->blk[dst->nr_blks++] = src->blk[idx]; - numa_remove_memblk_from(idx, src); -} - -/** - * numa_add_memblk - Add one numa_memblk to numa_meminfo - * @nid: NUMA node ID of the new memblk - * @start: Start address of the new memblk - * @end: End address of the new memblk - * - * Add a new memblk to the default numa_meminfo. - * - * RETURNS: - * 0 on success, -errno on failure. - */ -int __init numa_add_memblk(int nid, u64 start, u64 end) -{ - return numa_add_memblk_to(nid, start, end, &numa_meminfo); -} - -/** - * numa_cleanup_meminfo - Cleanup a numa_meminfo - * @mi: numa_meminfo to clean up - * - * Sanitize @mi by merging and removing unnecessary memblks. Also check for - * conflicts and clear unused memblks. - * - * RETURNS: - * 0 on success, -errno on failure. - */ -int __init numa_cleanup_meminfo(struct numa_meminfo *mi) -{ - const u64 low = 0; - const u64 high = PFN_PHYS(max_pfn); - int i, j, k; - - /* first, trim all entries */ - for (i = 0; i < mi->nr_blks; i++) { - struct numa_memblk *bi = &mi->blk[i]; - - /* move / save reserved memory ranges */ - if (!memblock_overlaps_region(&memblock.memory, - bi->start, bi->end - bi->start)) { - numa_move_tail_memblk(&numa_reserved_meminfo, i--, mi); - continue; - } - - /* make sure all non-reserved blocks are inside the limits */ - bi->start = max(bi->start, low); - - /* preserve info for non-RAM areas above 'max_pfn': */ - if (bi->end > high) { - numa_add_memblk_to(bi->nid, high, bi->end, - &numa_reserved_meminfo); - bi->end = high; - } - - /* and there's no empty block */ - if (bi->start >= bi->end) - numa_remove_memblk_from(i--, mi); - } - - /* merge neighboring / overlapping entries */ - for (i = 0; i < mi->nr_blks; i++) { - struct numa_memblk *bi = &mi->blk[i]; - - for (j = i + 1; j < mi->nr_blks; j++) { - struct numa_memblk *bj = &mi->blk[j]; - u64 start, end; - - /* - * See whether there are overlapping blocks. Whine - * about but allow overlaps of the same nid. They - * will be merged below. - */ - if (bi->end > bj->start && bi->start < bj->end) { - if (bi->nid != bj->nid) { - pr_err("node %d [mem %#010Lx-%#010Lx] overlaps with node %d [mem %#010Lx-%#010Lx]\n", - bi->nid, bi->start, bi->end - 1, - bj->nid, bj->start, bj->end - 1); - return -EINVAL; - } - pr_warn("Warning: node %d [mem %#010Lx-%#010Lx] overlaps with itself [mem %#010Lx-%#010Lx]\n", - bi->nid, bi->start, bi->end - 1, - bj->start, bj->end - 1); - } - - /* - * Join together blocks on the same node, holes - * between which don't overlap with memory on other - * nodes. - */ - if (bi->nid != bj->nid) - continue; - start = min(bi->start, bj->start); - end = max(bi->end, bj->end); - for (k = 0; k < mi->nr_blks; k++) { - struct numa_memblk *bk = &mi->blk[k]; - - if (bi->nid == bk->nid) - continue; - if (start < bk->end && end > bk->start) - break; - } - if (k < mi->nr_blks) - continue; - printk(KERN_INFO "NUMA: Node %d [mem %#010Lx-%#010Lx] + [mem %#010Lx-%#010Lx] -> [mem %#010Lx-%#010Lx]\n", - bi->nid, bi->start, bi->end - 1, bj->start, - bj->end - 1, start, end - 1); - bi->start = start; - bi->end = end; - numa_remove_memblk_from(j--, mi); - } - } - - /* clear unused ones */ - for (i = mi->nr_blks; i < ARRAY_SIZE(mi->blk); i++) { - mi->blk[i].start = mi->blk[i].end = 0; - mi->blk[i].nid = NUMA_NO_NODE; - } - - return 0; -} - -/* - * Set nodes, which have memory in @mi, in *@nodemask. - */ -static void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, - const struct numa_meminfo *mi) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(mi->blk); i++) - if (mi->blk[i].start != mi->blk[i].end && - mi->blk[i].nid != NUMA_NO_NODE) - node_set(mi->blk[i].nid, *nodemask); -} - /** * numa_reset_distance - Reset NUMA distance table * @@ -410,111 +219,13 @@ int __node_distance(int from, int to) } EXPORT_SYMBOL(__node_distance); -/* - * Mark all currently memblock-reserved physical memory (which covers the - * kernel's own memory ranges) as hot-unswappable. - */ -static void __init numa_clear_kernel_node_hotplug(void) -{ - nodemask_t reserved_nodemask = NODE_MASK_NONE; - struct memblock_region *mb_region; - int i; - - /* - * We have to do some preprocessing of memblock regions, to - * make them suitable for reservation. - * - * At this time, all memory regions reserved by memblock are - * used by the kernel, but those regions are not split up - * along node boundaries yet, and don't necessarily have their - * node ID set yet either. - * - * So iterate over all memory known to the x86 architecture, - * and use those ranges to set the nid in memblock.reserved. - * This will split up the memblock regions along node - * boundaries and will set the node IDs as well. - */ - for (i = 0; i < numa_meminfo.nr_blks; i++) { - struct numa_memblk *mb = numa_meminfo.blk + i; - int ret; - - ret = memblock_set_node(mb->start, mb->end - mb->start, &memblock.reserved, mb->nid); - WARN_ON_ONCE(ret); - } - - /* - * Now go over all reserved memblock regions, to construct a - * node mask of all kernel reserved memory areas. - * - * [ Note, when booting with mem=nn[kMG] or in a kdump kernel, - * numa_meminfo might not include all memblock.reserved - * memory ranges, because quirks such as trim_snb_memory() - * reserve specific pages for Sandy Bridge graphics. ] - */ - for_each_reserved_mem_region(mb_region) { - int nid = memblock_get_region_node(mb_region); - - if (nid != NUMA_NO_NODE) - node_set(nid, reserved_nodemask); - } - - /* - * Finally, clear the MEMBLOCK_HOTPLUG flag for all memory - * belonging to the reserved node mask. - * - * Note that this will include memory regions that reside - * on nodes that contain kernel memory - entire nodes - * become hot-unpluggable: - */ - for (i = 0; i < numa_meminfo.nr_blks; i++) { - struct numa_memblk *mb = numa_meminfo.blk + i; - - if (!node_isset(mb->nid, reserved_nodemask)) - continue; - - memblock_clear_hotplug(mb->start, mb->end - mb->start); - } -} - static int __init numa_register_memblks(struct numa_meminfo *mi) { - int i, nid; + int nid, err; - /* Account for nodes with cpus and no memory */ - node_possible_map = numa_nodes_parsed; - numa_nodemask_from_meminfo(&node_possible_map, mi); - if (WARN_ON(nodes_empty(node_possible_map))) - return -EINVAL; - - for (i = 0; i < mi->nr_blks; i++) { - struct numa_memblk *mb = &mi->blk[i]; - memblock_set_node(mb->start, mb->end - mb->start, - &memblock.memory, mb->nid); - } - - /* - * At very early time, the kernel have to use some memory such as - * loading the kernel image. We cannot prevent this anyway. So any - * node the kernel resides in should be un-hotpluggable. - * - * And when we come here, alloc node data won't fail. - */ - numa_clear_kernel_node_hotplug(); - - /* - * If sections array is gonna be used for pfn -> nid mapping, check - * whether its granularity is fine enough. - */ - if (IS_ENABLED(NODE_NOT_IN_PAGE_FLAGS)) { - unsigned long pfn_align = node_map_pfn_alignment(); - - if (pfn_align && pfn_align < PAGES_PER_SECTION) { - pr_warn("Node alignment %LuMB < min %LuMB, rejecting NUMA config\n", - PFN_PHYS(pfn_align) >> 20, - PFN_PHYS(PAGES_PER_SECTION) >> 20); - return -EINVAL; - } - } + err = numa_register_meminfo(mi); + if (err) + return err; if (!memblock_validate_numa_coverage(SZ_1M)) return -EINVAL; @@ -912,76 +623,3 @@ int memory_add_physaddr_to_nid(u64 start) EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); #endif - -static int __init cmp_memblk(const void *a, const void *b) -{ - const struct numa_memblk *ma = *(const struct numa_memblk **)a; - const struct numa_memblk *mb = *(const struct numa_memblk **)b; - - return (ma->start > mb->start) - (ma->start < mb->start); -} - -static struct numa_memblk *numa_memblk_list[NR_NODE_MEMBLKS] __initdata; - -/** - * numa_fill_memblks - Fill gaps in numa_meminfo memblks - * @start: address to begin fill - * @end: address to end fill - * - * Find and extend numa_meminfo memblks to cover the physical - * address range @start-@end - * - * RETURNS: - * 0 : Success - * NUMA_NO_MEMBLK : No memblks exist in address range @start-@end - */ - -int __init numa_fill_memblks(u64 start, u64 end) -{ - struct numa_memblk **blk = &numa_memblk_list[0]; - struct numa_meminfo *mi = &numa_meminfo; - int count = 0; - u64 prev_end; - - /* - * Create a list of pointers to numa_meminfo memblks that - * overlap start, end. The list is used to make in-place - * changes that fill out the numa_meminfo memblks. - */ - for (int i = 0; i < mi->nr_blks; i++) { - struct numa_memblk *bi = &mi->blk[i]; - - if (memblock_addrs_overlap(start, end - start, bi->start, - bi->end - bi->start)) { - blk[count] = &mi->blk[i]; - count++; - } - } - if (!count) - return NUMA_NO_MEMBLK; - - /* Sort the list of pointers in memblk->start order */ - sort(&blk[0], count, sizeof(blk[0]), cmp_memblk, NULL); - - /* Make sure the first/last memblks include start/end */ - blk[0]->start = min(blk[0]->start, start); - blk[count - 1]->end = max(blk[count - 1]->end, end); - - /* - * Fill any gaps by tracking the previous memblks - * end address and backfilling to it if needed. - */ - prev_end = blk[0]->end; - for (int i = 1; i < count; i++) { - struct numa_memblk *curr = blk[i]; - - if (prev_end >= curr->start) { - if (prev_end < curr->end) - prev_end = curr->end; - } else { - curr->start = prev_end; - prev_end = curr->end; - } - } - return 0; -} diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 235f8a4eb2fa..33610026b7a3 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "numa_internal.h" diff --git a/arch/x86/mm/numa_internal.h b/arch/x86/mm/numa_internal.h index 86860f279662..a51229a2f5af 100644 --- a/arch/x86/mm/numa_internal.h +++ b/arch/x86/mm/numa_internal.h @@ -5,23 +5,12 @@ #include #include -struct numa_memblk { - u64 start; - u64 end; - int nid; -}; - -struct numa_meminfo { - int nr_blks; - struct numa_memblk blk[NR_NODE_MEMBLKS]; -}; - -void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi); -int __init numa_cleanup_meminfo(struct numa_meminfo *mi); void __init numa_reset_distance(void); void __init x86_numa_init(void); +struct numa_meminfo; + #ifdef CONFIG_NUMA_EMU void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt); diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index e3f26e71637a..6f2983cbe553 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -17,6 +17,7 @@ #include #include #include +#include static nodemask_t nodes_found_map = NODE_MASK_NONE; diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c index 5949829a1b00..838747e319a2 100644 --- a/drivers/of/of_numa.c +++ b/drivers/of/of_numa.c @@ -10,6 +10,7 @@ #include #include #include +#include #include diff --git a/include/linux/numa_memblks.h b/include/linux/numa_memblks.h new file mode 100644 index 000000000000..6981cf97d2c9 --- /dev/null +++ b/include/linux/numa_memblks.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __NUMA_MEMBLKS_H +#define __NUMA_MEMBLKS_H + +#ifdef CONFIG_NUMA_MEMBLKS +#include + +#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2) + +struct numa_memblk { + u64 start; + u64 end; + int nid; +}; + +struct numa_meminfo { + int nr_blks; + struct numa_memblk blk[NR_NODE_MEMBLKS]; +}; + +extern struct numa_meminfo numa_meminfo __initdata_or_meminfo; +extern struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; + +int __init numa_add_memblk(int nodeid, u64 start, u64 end); +void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi); + +int __init numa_cleanup_meminfo(struct numa_meminfo *mi); +int __init numa_register_meminfo(struct numa_meminfo *mi); + +void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, + const struct numa_meminfo *mi); + +#endif /* CONFIG_NUMA_MEMBLKS */ + +#endif /* __NUMA_MEMBLKS_H */ diff --git a/mm/Kconfig b/mm/Kconfig index b4cb45255a54..15c6efbaa1df 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1249,6 +1249,9 @@ config IOMMU_MM_DATA config EXECMEM bool +config NUMA_MEMBLKS + bool + source "mm/damon/Kconfig" endmenu diff --git a/mm/Makefile b/mm/Makefile index 773b3b267438..17bc4013a2c5 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -140,3 +140,4 @@ obj-$(CONFIG_GENERIC_IOREMAP) += ioremap.o obj-$(CONFIG_SHRINKER_DEBUG) += shrinker_debug.o obj-$(CONFIG_EXECMEM) += execmem.o obj-$(CONFIG_NUMA) += numa.o +obj-$(CONFIG_NUMA_MEMBLKS) += numa_memblks.o diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c new file mode 100644 index 000000000000..72f191a94c66 --- /dev/null +++ b/mm/numa_memblks.c @@ -0,0 +1,385 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include +#include +#include + +nodemask_t numa_nodes_parsed __initdata; + +struct numa_meminfo numa_meminfo __initdata_or_meminfo; +struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; + +static int __init numa_add_memblk_to(int nid, u64 start, u64 end, + struct numa_meminfo *mi) +{ + /* ignore zero length blks */ + if (start == end) + return 0; + + /* whine about and ignore invalid blks */ + if (start > end || nid < 0 || nid >= MAX_NUMNODES) { + pr_warn("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n", + nid, start, end - 1); + return 0; + } + + if (mi->nr_blks >= NR_NODE_MEMBLKS) { + pr_err("too many memblk ranges\n"); + return -EINVAL; + } + + mi->blk[mi->nr_blks].start = start; + mi->blk[mi->nr_blks].end = end; + mi->blk[mi->nr_blks].nid = nid; + mi->nr_blks++; + return 0; +} + +/** + * numa_remove_memblk_from - Remove one numa_memblk from a numa_meminfo + * @idx: Index of memblk to remove + * @mi: numa_meminfo to remove memblk from + * + * Remove @idx'th numa_memblk from @mi by shifting @mi->blk[] and + * decrementing @mi->nr_blks. + */ +void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi) +{ + mi->nr_blks--; + memmove(&mi->blk[idx], &mi->blk[idx + 1], + (mi->nr_blks - idx) * sizeof(mi->blk[0])); +} + +/** + * numa_move_tail_memblk - Move a numa_memblk from one numa_meminfo to another + * @dst: numa_meminfo to append block to + * @idx: Index of memblk to remove + * @src: numa_meminfo to remove memblk from + */ +static void __init numa_move_tail_memblk(struct numa_meminfo *dst, int idx, + struct numa_meminfo *src) +{ + dst->blk[dst->nr_blks++] = src->blk[idx]; + numa_remove_memblk_from(idx, src); +} + +/** + * numa_add_memblk - Add one numa_memblk to numa_meminfo + * @nid: NUMA node ID of the new memblk + * @start: Start address of the new memblk + * @end: End address of the new memblk + * + * Add a new memblk to the default numa_meminfo. + * + * RETURNS: + * 0 on success, -errno on failure. + */ +int __init numa_add_memblk(int nid, u64 start, u64 end) +{ + return numa_add_memblk_to(nid, start, end, &numa_meminfo); +} + +/** + * numa_cleanup_meminfo - Cleanup a numa_meminfo + * @mi: numa_meminfo to clean up + * + * Sanitize @mi by merging and removing unnecessary memblks. Also check for + * conflicts and clear unused memblks. + * + * RETURNS: + * 0 on success, -errno on failure. + */ +int __init numa_cleanup_meminfo(struct numa_meminfo *mi) +{ + const u64 low = 0; + const u64 high = PFN_PHYS(max_pfn); + int i, j, k; + + /* first, trim all entries */ + for (i = 0; i < mi->nr_blks; i++) { + struct numa_memblk *bi = &mi->blk[i]; + + /* move / save reserved memory ranges */ + if (!memblock_overlaps_region(&memblock.memory, + bi->start, bi->end - bi->start)) { + numa_move_tail_memblk(&numa_reserved_meminfo, i--, mi); + continue; + } + + /* make sure all non-reserved blocks are inside the limits */ + bi->start = max(bi->start, low); + + /* preserve info for non-RAM areas above 'max_pfn': */ + if (bi->end > high) { + numa_add_memblk_to(bi->nid, high, bi->end, + &numa_reserved_meminfo); + bi->end = high; + } + + /* and there's no empty block */ + if (bi->start >= bi->end) + numa_remove_memblk_from(i--, mi); + } + + /* merge neighboring / overlapping entries */ + for (i = 0; i < mi->nr_blks; i++) { + struct numa_memblk *bi = &mi->blk[i]; + + for (j = i + 1; j < mi->nr_blks; j++) { + struct numa_memblk *bj = &mi->blk[j]; + u64 start, end; + + /* + * See whether there are overlapping blocks. Whine + * about but allow overlaps of the same nid. They + * will be merged below. + */ + if (bi->end > bj->start && bi->start < bj->end) { + if (bi->nid != bj->nid) { + pr_err("node %d [mem %#010Lx-%#010Lx] overlaps with node %d [mem %#010Lx-%#010Lx]\n", + bi->nid, bi->start, bi->end - 1, + bj->nid, bj->start, bj->end - 1); + return -EINVAL; + } + pr_warn("Warning: node %d [mem %#010Lx-%#010Lx] overlaps with itself [mem %#010Lx-%#010Lx]\n", + bi->nid, bi->start, bi->end - 1, + bj->start, bj->end - 1); + } + + /* + * Join together blocks on the same node, holes + * between which don't overlap with memory on other + * nodes. + */ + if (bi->nid != bj->nid) + continue; + start = min(bi->start, bj->start); + end = max(bi->end, bj->end); + for (k = 0; k < mi->nr_blks; k++) { + struct numa_memblk *bk = &mi->blk[k]; + + if (bi->nid == bk->nid) + continue; + if (start < bk->end && end > bk->start) + break; + } + if (k < mi->nr_blks) + continue; + pr_info("NUMA: Node %d [mem %#010Lx-%#010Lx] + [mem %#010Lx-%#010Lx] -> [mem %#010Lx-%#010Lx]\n", + bi->nid, bi->start, bi->end - 1, bj->start, + bj->end - 1, start, end - 1); + bi->start = start; + bi->end = end; + numa_remove_memblk_from(j--, mi); + } + } + + /* clear unused ones */ + for (i = mi->nr_blks; i < ARRAY_SIZE(mi->blk); i++) { + mi->blk[i].start = mi->blk[i].end = 0; + mi->blk[i].nid = NUMA_NO_NODE; + } + + return 0; +} + +/* + * Set nodes, which have memory in @mi, in *@nodemask. + */ +void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, + const struct numa_meminfo *mi) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(mi->blk); i++) + if (mi->blk[i].start != mi->blk[i].end && + mi->blk[i].nid != NUMA_NO_NODE) + node_set(mi->blk[i].nid, *nodemask); +} + +/* + * Mark all currently memblock-reserved physical memory (which covers the + * kernel's own memory ranges) as hot-unswappable. + */ +static void __init numa_clear_kernel_node_hotplug(void) +{ + nodemask_t reserved_nodemask = NODE_MASK_NONE; + struct memblock_region *mb_region; + int i; + + /* + * We have to do some preprocessing of memblock regions, to + * make them suitable for reservation. + * + * At this time, all memory regions reserved by memblock are + * used by the kernel, but those regions are not split up + * along node boundaries yet, and don't necessarily have their + * node ID set yet either. + * + * So iterate over all parsed memory blocks and use those ranges to + * set the nid in memblock.reserved. This will split up the + * memblock regions along node boundaries and will set the node IDs + * as well. + */ + for (i = 0; i < numa_meminfo.nr_blks; i++) { + struct numa_memblk *mb = numa_meminfo.blk + i; + int ret; + + ret = memblock_set_node(mb->start, mb->end - mb->start, + &memblock.reserved, mb->nid); + WARN_ON_ONCE(ret); + } + + /* + * Now go over all reserved memblock regions, to construct a + * node mask of all kernel reserved memory areas. + * + * [ Note, when booting with mem=nn[kMG] or in a kdump kernel, + * numa_meminfo might not include all memblock.reserved + * memory ranges, because quirks such as trim_snb_memory() + * reserve specific pages for Sandy Bridge graphics. ] + */ + for_each_reserved_mem_region(mb_region) { + int nid = memblock_get_region_node(mb_region); + + if (nid != MAX_NUMNODES) + node_set(nid, reserved_nodemask); + } + + /* + * Finally, clear the MEMBLOCK_HOTPLUG flag for all memory + * belonging to the reserved node mask. + * + * Note that this will include memory regions that reside + * on nodes that contain kernel memory - entire nodes + * become hot-unpluggable: + */ + for (i = 0; i < numa_meminfo.nr_blks; i++) { + struct numa_memblk *mb = numa_meminfo.blk + i; + + if (!node_isset(mb->nid, reserved_nodemask)) + continue; + + memblock_clear_hotplug(mb->start, mb->end - mb->start); + } +} + +int __init numa_register_meminfo(struct numa_meminfo *mi) +{ + int i; + + /* Account for nodes with cpus and no memory */ + node_possible_map = numa_nodes_parsed; + numa_nodemask_from_meminfo(&node_possible_map, mi); + if (WARN_ON(nodes_empty(node_possible_map))) + return -EINVAL; + + for (i = 0; i < mi->nr_blks; i++) { + struct numa_memblk *mb = &mi->blk[i]; + + memblock_set_node(mb->start, mb->end - mb->start, + &memblock.memory, mb->nid); + } + + /* + * At very early time, the kernel have to use some memory such as + * loading the kernel image. We cannot prevent this anyway. So any + * node the kernel resides in should be un-hotpluggable. + * + * And when we come here, alloc node data won't fail. + */ + numa_clear_kernel_node_hotplug(); + + /* + * If sections array is gonna be used for pfn -> nid mapping, check + * whether its granularity is fine enough. + */ + if (IS_ENABLED(NODE_NOT_IN_PAGE_FLAGS)) { + unsigned long pfn_align = node_map_pfn_alignment(); + + if (pfn_align && pfn_align < PAGES_PER_SECTION) { + pr_warn("Node alignment %LuMB < min %LuMB, rejecting NUMA config\n", + PFN_PHYS(pfn_align) >> 20, + PFN_PHYS(PAGES_PER_SECTION) >> 20); + return -EINVAL; + } + } + + return 0; +} + +static int __init cmp_memblk(const void *a, const void *b) +{ + const struct numa_memblk *ma = *(const struct numa_memblk **)a; + const struct numa_memblk *mb = *(const struct numa_memblk **)b; + + return (ma->start > mb->start) - (ma->start < mb->start); +} + +static struct numa_memblk *numa_memblk_list[NR_NODE_MEMBLKS] __initdata; + +/** + * numa_fill_memblks - Fill gaps in numa_meminfo memblks + * @start: address to begin fill + * @end: address to end fill + * + * Find and extend numa_meminfo memblks to cover the physical + * address range @start-@end + * + * RETURNS: + * 0 : Success + * NUMA_NO_MEMBLK : No memblks exist in address range @start-@end + */ + +int __init numa_fill_memblks(u64 start, u64 end) +{ + struct numa_memblk **blk = &numa_memblk_list[0]; + struct numa_meminfo *mi = &numa_meminfo; + int count = 0; + u64 prev_end; + + /* + * Create a list of pointers to numa_meminfo memblks that + * overlap start, end. The list is used to make in-place + * changes that fill out the numa_meminfo memblks. + */ + for (int i = 0; i < mi->nr_blks; i++) { + struct numa_memblk *bi = &mi->blk[i]; + + if (memblock_addrs_overlap(start, end - start, bi->start, + bi->end - bi->start)) { + blk[count] = &mi->blk[i]; + count++; + } + } + if (!count) + return NUMA_NO_MEMBLK; + + /* Sort the list of pointers in memblk->start order */ + sort(&blk[0], count, sizeof(blk[0]), cmp_memblk, NULL); + + /* Make sure the first/last memblks include start/end */ + blk[0]->start = min(blk[0]->start, start); + blk[count - 1]->end = max(blk[count - 1]->end, end); + + /* + * Fill any gaps by tracking the previous memblks + * end address and backfilling to it if needed. + */ + prev_end = blk[0]->end; + for (int i = 1; i < count; i++) { + struct numa_memblk *curr = blk[i]; + + if (prev_end >= curr->start) { + if (prev_end < curr->end) + prev_end = curr->end; + } else { + curr->start = prev_end; + prev_end = curr->end; + } + } + return 0; +} From patchwork Tue Jul 23 06:41:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739446 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 558F2C3DA49 for ; Tue, 23 Jul 2024 06:45:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C9D536B00B3; Tue, 23 Jul 2024 02:45:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C253A6B00B4; Tue, 23 Jul 2024 02:45:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC5E56B00B5; Tue, 23 Jul 2024 02:45:50 -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 8A0BE6B00B3 for ; Tue, 23 Jul 2024 02:45:50 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2F2D5C1C18 for ; Tue, 23 Jul 2024 06:45:50 +0000 (UTC) X-FDA: 82370082060.04.4C87560 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 7BCB9100004 for ; Tue, 23 Jul 2024 06:45:48 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pXyUTJ1K; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717125; 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=tRIHjf2S9HbS4Z//YnS86TKWnzN+IleAIApVhVvKk/w=; b=hruQLEYfd/2UnUgn31Kp2qgeED3KYUA88O8vFgRAfAyt5/bHrzI50V69nCnyjlHG1+hL3Q 5KlkBHf4mA/rEKVCAF0jNPtSMomzl8tD7B9fKPo28nSAllrkZfM8AisHC/45rf7g1y16li /AOYm6M1eW8S1ldtN62rMfaUKNMLr68= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pXyUTJ1K; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717125; a=rsa-sha256; cv=none; b=eP1Wd3nJMVOQ/DyfMmQZPCrVyJG4Xwg7xcFClkuAkAxAc5wbngSjSh1eMc6e0j4NWPMJNr b00AusTNV3Hkxr3jK/U4EegEsXiDTiGWbQeqREMmXFS/iR1sxS7ivVs3o0/E8IvYRwB0YU u8CfTJlTZNSxQ6qTfeHApZCdHCpY3s8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B30AD60A3B; Tue, 23 Jul 2024 06:45:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62871C4AF0B; Tue, 23 Jul 2024 06:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717147; bh=BMzYC9t5QuwdECGq/0fBoBhxOHJUxmDFhThI+5y02vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXyUTJ1K6KmdxcOzNFBhx10UAi7KtrWf2AC3cALBHu4GHYptWrJdZs84KnVQHe9+r 6L7sZnWwWkvamwENwdFcjOPa7Ik7CfES8b2PphVrh8Z4/TtDm8a2zXTvuTr7RxjG0Y U8yG00iMG5cROM2FJH+nUaCOsq3QjYflzEYICYyV0Bq+tuO57Wnm7MvSa5w0eTT61l riNbmax5cb3PLTX/FW5nUjwSlej24ad9+5YG1ZAjplXI46GgWTYHEC0ipmUoCbEtA+ SCCP/H+rkG97RIat7tZtGxcVnQ17gKXpjVmbibUY4TWBt31zk2JBZoWoVAZDFUP42w HhmDiQLPvcwSw== 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 18/25] mm: move numa_distance and related code from x86 to numa_memblks Date: Tue, 23 Jul 2024 09:41:49 +0300 Message-ID: <20240723064156.4009477-19-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: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 7BCB9100004 X-Stat-Signature: sce7f4e1dzikhu6zdzq714wce636pfty X-HE-Tag: 1721717148-697647 X-HE-Meta: U2FsdGVkX19lFL76U0KkfCklJihMooM70eR4Ag9gWAwPsiSB8UEMQxgPsGTsVx5py3l2+AAtifekRtys6TD+WasZjGiKtroN1wLQNixUz002kTkIkrz0TFj9I1E9KCP83x7KXU+vRgyR9wT17dwEpnxrueq3kpo/++w5Bhglormk2aOPkXZD+5as0gBw9S06S/ZWIoLA0NxoBCXX7yxeVUovxK07ccGV3A3QzxmLOEkMYagrOmorxA+YEHofOqHkMznb4SpCgGPGppqReq7y7JLC9D39yF7HOLviSepa2BTNHIjXTPEDIXMARgf1L8Lm527O7goq3D/8XUwuRru2lR5vcjvts7ts2l/U29cgnahNMY1ZXbrpLeUAV3hCFgVvLnCkrcUEF2dROhdkrtAn+VyR/TeaO0cC4BTWBkklqxlwScmJAD9nucgBKFwMZL0/zkooel53S1FwTOofzi1VMMPdgHyFU5uI0SX+V3G+JwzJybvzD9OqS4NnzYgTFNRtrHN7kACrFtQmfxO6xBzccjx5+RdELRxLrtZi9cfl+2UmM4wumoUyUN3WUSd2la56Wo14YOqNxhjbB4XgV5bOlW2ILljPEIwaUBWLxB9TaE51dmYIua5oIU9qZUfO13ifTjykbISdE9+vohYBB2KCeTAhHYujSAKKFk5G7QdKGXTIMej63wPFtqzzZ4WqoA5nrzw+jNkDYDOJq9wGKC+aVTfMOVRhdcXayw5t5l9ivJa0XsjPRk2YxkbqUzKVBIGGyjcROvI15Gv7qmTlMfkCzmY/0W2U5NERi+aVEKniTVgJ5M6urOf1y04PG9I8DkPUNYvQOU0mgeZMY95KhfcvFoLqfM/4DuJnbZvAKWIV97rGzWLsbu0asbezPl5sRx6Azz5aHnunq5fFy7AVlpSWWOuxttVYiOFhk85mr5PwKpqQbZMB1MEl1DoTwEWwYpGz4lPJy3f9ZmdfLdJ5PbM T5WUNNlc VZpe/iA9xNEqh1nrPpSXG/g3cVYwAhRDkGI7k1s/39hZ+4QOnIodwo/tHsApVO0/hgZ+0OpJzl4g8SehYGbvWIXVD37ZwhKqF7iqQF4fPbpLYRsWtuOUbeqjRnqtmQKZ6+z3kI5cuSpRJNvjEs9Zpy/lJBsvjRSMS1TJic+0Xkh/A375dc1mTuw7DFesbXJaWoKpB27YuI0JONTOLF5c7pFZP3BJI84pYvYHj6PUTiHv7LsrMgPHYXz7KTacXI+10q/Nra91macDwwhOL3Ku8kMy5wRAwJdqDtpX+GbLiz3Uoq1kYsXmGgBtb9/h9WnZs1ZhpnLod17x9GTc= 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)" Move code dealing with numa_distance array from arch/x86 to mm/numa_memblks.c This code will be later reused by arch_numa. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/include/asm/numa.h | 2 - arch/x86/mm/numa.c | 104 ----------------------------------- arch/x86/mm/numa_internal.h | 2 - include/linux/numa_memblks.h | 4 ++ mm/numa_memblks.c | 104 +++++++++++++++++++++++++++++++++++ 5 files changed, 108 insertions(+), 108 deletions(-) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index 6e9a50bf03d4..203100500f24 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -23,8 +23,6 @@ extern int numa_off; extern s16 __apicid_to_node[MAX_LOCAL_APIC]; extern nodemask_t numa_nodes_parsed __initdata; -extern void __init numa_set_distance(int from, int to, int distance); - static inline void set_apicid_to_node(int apicid, s16 node) { __apicid_to_node[apicid] = node; diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 6874d5650b4d..8eb15578625e 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -24,9 +24,6 @@ int numa_off; -static int numa_distance_cnt; -static u8 *numa_distance; - static __init int numa_setup(char *opt) { if (!opt) @@ -118,107 +115,6 @@ void __init setup_node_to_cpumask_map(void) pr_debug("Node to cpumask map for %u nodes\n", nr_node_ids); } -/** - * numa_reset_distance - Reset NUMA distance table - * - * The current table is freed. The next numa_set_distance() call will - * create a new one. - */ -void __init numa_reset_distance(void) -{ - size_t size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]); - - /* numa_distance could be 1LU marking allocation failure, test cnt */ - if (numa_distance_cnt) - memblock_free(numa_distance, size); - numa_distance_cnt = 0; - numa_distance = NULL; /* enable table creation */ -} - -static int __init numa_alloc_distance(void) -{ - nodemask_t nodes_parsed; - size_t size; - int i, j, cnt = 0; - - /* size the new table and allocate it */ - nodes_parsed = numa_nodes_parsed; - numa_nodemask_from_meminfo(&nodes_parsed, &numa_meminfo); - - for_each_node_mask(i, nodes_parsed) - cnt = i; - cnt++; - size = cnt * cnt * sizeof(numa_distance[0]); - - numa_distance = memblock_alloc(size, PAGE_SIZE); - if (!numa_distance) { - pr_warn("Warning: can't allocate distance table!\n"); - /* don't retry until explicitly reset */ - numa_distance = (void *)1LU; - return -ENOMEM; - } - - numa_distance_cnt = cnt; - - /* fill with the default distances */ - for (i = 0; i < cnt; i++) - for (j = 0; j < cnt; j++) - numa_distance[i * cnt + j] = i == j ? - LOCAL_DISTANCE : REMOTE_DISTANCE; - printk(KERN_DEBUG "NUMA: Initialized distance table, cnt=%d\n", cnt); - - return 0; -} - -/** - * numa_set_distance - Set NUMA distance from one NUMA to another - * @from: the 'from' node to set distance - * @to: the 'to' node to set distance - * @distance: NUMA distance - * - * Set the distance from node @from to @to to @distance. If distance table - * doesn't exist, one which is large enough to accommodate all the currently - * known nodes will be created. - * - * If such table cannot be allocated, a warning is printed and further - * calls are ignored until the distance table is reset with - * numa_reset_distance(). - * - * If @from or @to is higher than the highest known node or lower than zero - * at the time of table creation or @distance doesn't make sense, the call - * is ignored. - * This is to allow simplification of specific NUMA config implementations. - */ -void __init numa_set_distance(int from, int to, int distance) -{ - if (!numa_distance && numa_alloc_distance() < 0) - return; - - if (from >= numa_distance_cnt || to >= numa_distance_cnt || - from < 0 || to < 0) { - pr_warn_once("Warning: node ids are out of bound, from=%d to=%d distance=%d\n", - from, to, distance); - return; - } - - if ((u8)distance != distance || - (from == to && distance != LOCAL_DISTANCE)) { - pr_warn_once("Warning: invalid distance parameter, from=%d to=%d distance=%d\n", - from, to, distance); - return; - } - - numa_distance[from * numa_distance_cnt + to] = distance; -} - -int __node_distance(int from, int to) -{ - if (from >= numa_distance_cnt || to >= numa_distance_cnt) - return from == to ? LOCAL_DISTANCE : REMOTE_DISTANCE; - return numa_distance[from * numa_distance_cnt + to]; -} -EXPORT_SYMBOL(__node_distance); - static int __init numa_register_memblks(struct numa_meminfo *mi) { int nid, err; diff --git a/arch/x86/mm/numa_internal.h b/arch/x86/mm/numa_internal.h index a51229a2f5af..249e3aaeadce 100644 --- a/arch/x86/mm/numa_internal.h +++ b/arch/x86/mm/numa_internal.h @@ -5,8 +5,6 @@ #include #include -void __init numa_reset_distance(void); - void __init x86_numa_init(void); struct numa_meminfo; diff --git a/include/linux/numa_memblks.h b/include/linux/numa_memblks.h index 6981cf97d2c9..968a590535ac 100644 --- a/include/linux/numa_memblks.h +++ b/include/linux/numa_memblks.h @@ -7,6 +7,10 @@ #define NR_NODE_MEMBLKS (MAX_NUMNODES * 2) +extern int numa_distance_cnt; +void __init numa_set_distance(int from, int to, int distance); +void __init numa_reset_distance(void); + struct numa_memblk { u64 start; u64 end; diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c index 72f191a94c66..e3c3519725d4 100644 --- a/mm/numa_memblks.c +++ b/mm/numa_memblks.c @@ -7,11 +7,115 @@ #include #include +int numa_distance_cnt; +static u8 *numa_distance; + nodemask_t numa_nodes_parsed __initdata; struct numa_meminfo numa_meminfo __initdata_or_meminfo; struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; +/** + * numa_reset_distance - Reset NUMA distance table + * + * The current table is freed. The next numa_set_distance() call will + * create a new one. + */ +void __init numa_reset_distance(void) +{ + size_t size = numa_distance_cnt * numa_distance_cnt * sizeof(numa_distance[0]); + + /* numa_distance could be 1LU marking allocation failure, test cnt */ + if (numa_distance_cnt) + memblock_free(numa_distance, size); + numa_distance_cnt = 0; + numa_distance = NULL; /* enable table creation */ +} + +static int __init numa_alloc_distance(void) +{ + nodemask_t nodes_parsed; + size_t size; + int i, j, cnt = 0; + + /* size the new table and allocate it */ + nodes_parsed = numa_nodes_parsed; + numa_nodemask_from_meminfo(&nodes_parsed, &numa_meminfo); + + for_each_node_mask(i, nodes_parsed) + cnt = i; + cnt++; + size = cnt * cnt * sizeof(numa_distance[0]); + + numa_distance = memblock_alloc(size, PAGE_SIZE); + if (!numa_distance) { + pr_warn("Warning: can't allocate distance table!\n"); + /* don't retry until explicitly reset */ + numa_distance = (void *)1LU; + return -ENOMEM; + } + + numa_distance_cnt = cnt; + + /* fill with the default distances */ + for (i = 0; i < cnt; i++) + for (j = 0; j < cnt; j++) + numa_distance[i * cnt + j] = i == j ? + LOCAL_DISTANCE : REMOTE_DISTANCE; + printk(KERN_DEBUG "NUMA: Initialized distance table, cnt=%d\n", cnt); + + return 0; +} + +/** + * numa_set_distance - Set NUMA distance from one NUMA to another + * @from: the 'from' node to set distance + * @to: the 'to' node to set distance + * @distance: NUMA distance + * + * Set the distance from node @from to @to to @distance. If distance table + * doesn't exist, one which is large enough to accommodate all the currently + * known nodes will be created. + * + * If such table cannot be allocated, a warning is printed and further + * calls are ignored until the distance table is reset with + * numa_reset_distance(). + * + * If @from or @to is higher than the highest known node or lower than zero + * at the time of table creation or @distance doesn't make sense, the call + * is ignored. + * This is to allow simplification of specific NUMA config implementations. + */ +void __init numa_set_distance(int from, int to, int distance) +{ + if (!numa_distance && numa_alloc_distance() < 0) + return; + + if (from >= numa_distance_cnt || to >= numa_distance_cnt || + from < 0 || to < 0) { + pr_warn_once("Warning: node ids are out of bound, from=%d to=%d distance=%d\n", + from, to, distance); + return; + } + + if ((u8)distance != distance || + (from == to && distance != LOCAL_DISTANCE)) { + pr_warn_once("Warning: invalid distance parameter, from=%d to=%d distance=%d\n", + from, to, distance); + return; + } + + numa_distance[from * numa_distance_cnt + to] = distance; +} + +int __node_distance(int from, int to) +{ + if (from >= numa_distance_cnt || to >= numa_distance_cnt) + return from == to ? LOCAL_DISTANCE : REMOTE_DISTANCE; + return numa_distance[from * numa_distance_cnt + to]; +} +EXPORT_SYMBOL(__node_distance); + static int __init numa_add_memblk_to(int nid, u64 start, u64 end, struct numa_meminfo *mi) { From patchwork Tue Jul 23 06:41:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739447 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 A1090C3DA49 for ; Tue, 23 Jul 2024 06:46:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 264C06B00B4; Tue, 23 Jul 2024 02:46:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 213416B00B6; Tue, 23 Jul 2024 02:46:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B40A6B00B7; Tue, 23 Jul 2024 02:46:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DDD186B00B4 for ; Tue, 23 Jul 2024 02:46:04 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A605AA5E46 for ; Tue, 23 Jul 2024 06:46:04 +0000 (UTC) X-FDA: 82370082648.04.56E9F02 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf18.hostedemail.com (Postfix) with ESMTP id 664451C0025 for ; Tue, 23 Jul 2024 06:46:02 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=S2VpYoVm; spf=pass (imf18.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717127; 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=nByA89AMuruUBQqwNJQrSHQjjiCmK3RL3+YeA9z0jjo=; b=S6MuXf3D525DCwWRUskJnM5AAnAAjC+l+RaUryw0ltpummQkCwtjn7Ztx7oU9kvMgJNWZV bUaEXS2yqESbFxl/1tsi1ZNrhwyh08TVjlk+hwlUvZ3ZgDxJldWH82TRYlWe8Kw5YgGrk4 Bx4L1Z2ayJmGQRxz61dZILP4M4+sbCI= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=S2VpYoVm; spf=pass (imf18.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717127; a=rsa-sha256; cv=none; b=2H3D1ISQWF4Qxq7KKc9hjzW5p1/Tcex/HYpem8l7e1KADXDL96ClGgmToVqeGUp+MX/Ns8 5hCDQrYMbk2G6Mmqx1LbM9EBu6Kxu39krnfwNUFG4kZAiSYAJMjgOiFEnyCicY0tR30J2L nv0MVUNW40np+9gpDRoT9W+fx1uzGDk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A67E2CE0BBB; Tue, 23 Jul 2024 06:45:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB686C4AF0B; Tue, 23 Jul 2024 06:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717159; bh=rbVckViSVk+mWr74pnwR2o+U7UjRpaIJSEgglVAH+jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S2VpYoVmHlTiPzU8OqPPA83vMOFMf/PIBBBHYwi5Wo+QDdtmOGBN5Sscv5TCpLxgN NZO/x31toKmJYKIOruH56bVAhmJIg6nm0awNn5f/75Hd+0paV3Uw+mTYwKmGwaC8Zq wb7M9OglSTyQU+edoI3r5AnDjjNVZA7pNqCl13LuGKJXc4OhXnw5Y2jv+06YxhonfG 2hX1hXiw8/5LQKlf61IepqOIywzamX/NcfHLYTl5mEaMJIfQdGJ1cGB68C0lPPiz8c IoYAnoWIrKfPiDCSKfBVWMaTsbhpQXAwtUx1ww+ePFzxX42z9MKcussciG9QVw3dBx XAvULj29Krlrw== 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 19/25] mm: introduce numa_emulation Date: Tue, 23 Jul 2024 09:41:50 +0300 Message-ID: <20240723064156.4009477-20-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-Stat-Signature: u1fq991kc55jit398gcbtzazsrcf7xa5 X-Rspam-User: X-Rspamd-Queue-Id: 664451C0025 X-Rspamd-Server: rspam02 X-HE-Tag: 1721717162-216887 X-HE-Meta: U2FsdGVkX1+ca7MPlwDfklg1pdtzBGWmckeg+UtQ3MoC0RJkv+zks64Vt1cE52Lliu+D3eOA+crRtd6xW2aX8oGNPglpBLppx8aJKeMTY77BGFAMFybdZiQxp76TeBG/efF++Lu4klPU5eOTwVjgIm+jIBLPNBPLremAfl6bP4E9RRklC49HPBQZ+BH4eDzRYy8Wasn2y6sjAGMAQ+g5peibgpXe49T8MC3PpPSrgWCsO6iHfXD7qTNJUejBMm6ZmOLBFItTISth18VuZOifYicKOiAXj7hhbK2uplrIFQCZ5zKQPIrB2C2BosYJxj2O/Q9ITXeEXcuAitNcACxTlOKmz5sElC4D7Wx8J3GCLn6U2ZtjqSX5IFVDAS1PFpA4nVcY/nrykc7acQ/qHp1O1gnZWzuuY6eCy1HRsmrBViN0i29UvobAXBxohZglIdnLogu/frCbOpWwSponiACTqCQkwfE7vBQVPXQN+LaC/RMvua4cfi1jovn7EhUF2IZvnWvo9WLuArsOscbroekut02EEO0zxtX87NbS5VK0SWJ6gFN4w7ASE5+/MaeP1HYMkapNdkxHALIIiFjuKftsy/ymQOrbt+ZyPRCt+4Ga7eidV/+S74sU2qRj9ihqJ+S3LKvgV4sl8R1FwSGVU1X50oiHup+r/ZTErszb5DOH2NEPTl7dJBlIEDzmawOtY5unuYGM24nxzcU7NCMtTzUN3mAQ0R5GoDNvWdBrBgdzdWS3TCpiLhpaMgP4Yik6WXyhv8lE4ZNvC5gqBAdVtF96Tb0EPIZQ6cMRALBGGfkoD1mjoOJgGU0T5LWN78R6+6JwLHoHnwHtEQBmSg3w0d9eO/G8Kgqg9wk/zKIYYRmpjDfXUQyhdjZ2aY1Ih9AJHIVQfdujKuJvqfQBA+rWZEPlXd6eizNM+WCj3lR93gDH65+LR12OiTiLR86fBqgKkKtjXkZQqpk8s6w+FKyvsuq ARZNGLvW NHy6JarDyP9+oA/RNWcV5xswCKoPKpYLullqfsz3jHiIXutPy1tEI1XSJce0C3bviNYIpkjVrpqqjd3k4Jwr8qZ4cima6ubgopYzwjjBEvmjjKFkXOix9wluCarXZ/kkFT0pJ1Ds/EJgwZx8hqDicoRrs33hzbg2sdHyHmRS7QB73eYOc46k+JOOvqKuDJ1+E26zTTerXmZI+xx62sswXQmwwiDco7z/6YIA6+mYsHAkjsI8b9vU1TMRObJ8enPGF2x0W9bNjcrA4TOR0fZJs58q7BbBtMFU92bcTPwsUZHMyjDU2fvR+GFEBQnmpB7VwGcvc 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)" Move numa_emulation codfrom arch/x86 to mm/numa_emulation.c This code will be later reused by arch_numa. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/Kconfig | 8 -------- arch/x86/include/asm/numa.h | 12 ------------ arch/x86/mm/Makefile | 1 - arch/x86/mm/numa_internal.h | 11 ----------- include/linux/numa_memblks.h | 17 +++++++++++++++++ mm/Kconfig | 8 ++++++++ mm/Makefile | 1 + {arch/x86/mm => mm}/numa_emulation.c | 4 +--- 8 files changed, 27 insertions(+), 35 deletions(-) rename {arch/x86/mm => mm}/numa_emulation.c (99%) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d8084f37157c..a42735c126fa 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1592,14 +1592,6 @@ config X86_64_ACPI_NUMA help Enable ACPI SRAT based node topology detection. -config NUMA_EMU - bool "NUMA emulation" - depends on NUMA - help - Enable NUMA emulation. A flat machine will be split - into virtual nodes when booted with "numa=fake=N", where N is the - number of nodes. This is only useful for debugging. - config NODES_SHIFT int "Maximum NUMA Nodes (as a power of 2)" if !MAXSMP range 1 10 diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index 203100500f24..5469d7a7c40f 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -65,16 +65,4 @@ static inline void init_gi_nodes(void) { } void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable); #endif -#ifdef CONFIG_NUMA_EMU -int numa_emu_cmdline(char *str); -void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys, - unsigned int nr_emu_nids); -u64 __init numa_emu_dma_end(void); -#else /* CONFIG_NUMA_EMU */ -static inline int numa_emu_cmdline(char *str) -{ - return -EINVAL; -} -#endif /* CONFIG_NUMA_EMU */ - #endif /* _ASM_X86_NUMA_H */ diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index 8d3a00e5c528..690fbf48e853 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile @@ -57,7 +57,6 @@ obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o obj-$(CONFIG_NUMA) += numa.o numa_$(BITS).o obj-$(CONFIG_AMD_NUMA) += amdtopology.o obj-$(CONFIG_ACPI_NUMA) += srat.o -obj-$(CONFIG_NUMA_EMU) += numa_emulation.o obj-$(CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS) += pkeys.o obj-$(CONFIG_RANDOMIZE_MEMORY) += kaslr.o diff --git a/arch/x86/mm/numa_internal.h b/arch/x86/mm/numa_internal.h index 249e3aaeadce..11e1ff370c10 100644 --- a/arch/x86/mm/numa_internal.h +++ b/arch/x86/mm/numa_internal.h @@ -7,15 +7,4 @@ void __init x86_numa_init(void); -struct numa_meminfo; - -#ifdef CONFIG_NUMA_EMU -void __init numa_emulation(struct numa_meminfo *numa_meminfo, - int numa_dist_cnt); -#else -static inline void numa_emulation(struct numa_meminfo *numa_meminfo, - int numa_dist_cnt) -{ } -#endif - #endif /* __X86_MM_NUMA_INTERNAL_H */ diff --git a/include/linux/numa_memblks.h b/include/linux/numa_memblks.h index 968a590535ac..f81f98678074 100644 --- a/include/linux/numa_memblks.h +++ b/include/linux/numa_memblks.h @@ -34,6 +34,23 @@ int __init numa_register_meminfo(struct numa_meminfo *mi); void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, const struct numa_meminfo *mi); +#ifdef CONFIG_NUMA_EMU +int numa_emu_cmdline(char *str); +void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys, + unsigned int nr_emu_nids); +u64 __init numa_emu_dma_end(void); +void __init numa_emulation(struct numa_meminfo *numa_meminfo, + int numa_dist_cnt); +#else +static inline void numa_emulation(struct numa_meminfo *numa_meminfo, + int numa_dist_cnt) +{ } +static inline int numa_emu_cmdline(char *str) +{ + return -EINVAL; +} +#endif /* CONFIG_NUMA_EMU */ + #endif /* CONFIG_NUMA_MEMBLKS */ #endif /* __NUMA_MEMBLKS_H */ diff --git a/mm/Kconfig b/mm/Kconfig index 15c6efbaa1df..ae58eecdefdc 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1252,6 +1252,14 @@ config EXECMEM config NUMA_MEMBLKS bool +config NUMA_EMU + bool "NUMA emulation" + depends on NUMA_MEMBLKS + help + Enable NUMA emulation. A flat machine will be split + into virtual nodes when booted with "numa=fake=N", where N is the + number of nodes. This is only useful for debugging. + source "mm/damon/Kconfig" endmenu diff --git a/mm/Makefile b/mm/Makefile index 17bc4013a2c5..d5b1b30f76e3 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -141,3 +141,4 @@ obj-$(CONFIG_SHRINKER_DEBUG) += shrinker_debug.o obj-$(CONFIG_EXECMEM) += execmem.o obj-$(CONFIG_NUMA) += numa.o obj-$(CONFIG_NUMA_MEMBLKS) += numa_memblks.o +obj-$(CONFIG_NUMA_EMU) += numa_emulation.o diff --git a/arch/x86/mm/numa_emulation.c b/mm/numa_emulation.c similarity index 99% rename from arch/x86/mm/numa_emulation.c rename to mm/numa_emulation.c index 33610026b7a3..031fb9961bf7 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/mm/numa_emulation.c @@ -7,9 +7,7 @@ #include #include #include -#include - -#include "numa_internal.h" +#include #define FAKE_NODE_MIN_SIZE ((u64)32 << 20) #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) From patchwork Tue Jul 23 06:41:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739448 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 78938C3DA63 for ; Tue, 23 Jul 2024 06:46:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DE096B00B6; Tue, 23 Jul 2024 02:46:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 065906B00B8; Tue, 23 Jul 2024 02:46:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E22016B00B9; Tue, 23 Jul 2024 02:46:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BD91F6B00B6 for ; Tue, 23 Jul 2024 02:46:16 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 20CD841C9F for ; Tue, 23 Jul 2024 06:46:16 +0000 (UTC) X-FDA: 82370083152.28.0F3135A Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf03.hostedemail.com (Postfix) with ESMTP id C9F5220018 for ; Tue, 23 Jul 2024 06:46:13 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ntd+jqKC; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717112; 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=B56A3RFx4+8h26gV5w8yLOzvNYXFit95iiy/6g4/hcw=; b=P2/kB2dYxsMHv5jWAeWnsBsS4yaBYsTtst8meq9BEwmOFpj5EbqR5F3lW//+bPdBv+ggWV p5Hbvxt0xtiB8HbRxjRvtspSZPKtzaS3FFtYWwu5/7me8GKJwtHVAgD2xJ9tffP3vLJGhX kn4tBncVQgw+ti03sVkztal9l80wrcE= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ntd+jqKC; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717112; a=rsa-sha256; cv=none; b=AiOw3D5LHQX++ubffgPqxCVNLR3fY4xV+6tQ0RqB1zGVoMvF4IxX2R6ju3DtrMg+X9uidX 8NUhwJ6sdelVeXP0/leUWRY5F+I798/NE26AlXTASydBgoSAQcZpHgxx6bIp4AIlknlFNH 80TQupG3daz2up4p9xe8Ts1+rpGGrfw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 3B21ECE0DA0; Tue, 23 Jul 2024 06:46:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F421C4AF09; Tue, 23 Jul 2024 06:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717170; bh=kD57Jpdf1Sifrg0HuWEuP1eEmN5e3TwpoxqLH1SlKlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ntd+jqKCTeoDnExqCCdBPL7lv8CDP772xGvpJYnoZB3H1j5K4RaH1Pm3hR5MWjY2F mbNgHo/qOcYQJ2f3LkNpJ2aJhWE5NDhNohDv5Y9x7zkMfJqfewkRJCmGmr8Kt3hLHw QOlKJXxNpgbtrruPZxfNG/pJ+VzgN6ZMT7DkBpingearXPAtfb2U0n8SibZi/+LeH0 x/4CucxKu2uwRSNRBQsKuBvzPemwWatFIN+LX+NZa6PcrSDsTSMSIYm/V3ac/p/Nl+ iXzOBbWEJbd6omVeZW9TKKP/31EDm43NyeP/lxVBXrGVoR+lfACPRO3bnQTDaDngVg BbxVg2bri0umw== 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 20/25] mm: numa_memblks: introduce numa_memblks_init Date: Tue, 23 Jul 2024 09:41:51 +0300 Message-ID: <20240723064156.4009477-21-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: rspam06 X-Rspamd-Queue-Id: C9F5220018 X-Stat-Signature: 4w8f3knigjai8fz8jbfghobixheggwik X-Rspam-User: X-HE-Tag: 1721717173-189383 X-HE-Meta: U2FsdGVkX18szJ4JdbIGiTxkzFV0AWlqnniuxgcl0ZwDeKIsuaRek7BhzJ2JAVIwASPlLZxZllZxVIsTt/MvKgm3ZAku5FxSuTj//2Yn5qQLixYUxRyem3tVWF6ZQd6usPwssV9zX5JztLfLaA4dpwSTkiN7MGZZN5DFSMiLKpUlvwPCOGHSS2nSS6uWUSCj+HToAeLI87mA7uQnZ8JB/RGvMCxqHxq1RCnqNkP3GH11ABsMXrs1gx/WqLdoIJ0BjtlDFeEXm4fQpSckXe2j++w7HYrrmtNSZtAb1YzE83x/5t3P4Rjzs5giMJ1nHyw6FtNW0t4qi6icIqaDLkdpLqY6BoypajBcvRGGiHh0F+01ljdFOEP217MpIKdnB7oEenMG11MS1GtOGIPp/TieHPUGwT8bZddce2vdyy1p8TQKbVkO2pOL387tVtACBuJobQeDGlmeP4w3sGCa1zvcZJdL/Fx+TKZ39/Dkr/xZfpqjW0wyNf721TKFVnd9JENINBJYiEsDIZO1Hmsbp4sbAfUVqH5m2ki5v5NC00ZykWZXGHat3zkj09zXoOvdaH0lbNQQBRWFCr1SseSwiewXHQ05AwKKFsTVx38vDgACyu4wEYnmmkdmVbVDs10SyuBmiBU6samw8wrA3cWxiL5eMy6IsVSY62u/QL0j2mLgAc/w2l/0dpFTdeGubIJGRMwDy5JhYFH/neNd/TKo4Id+VS/6wzJDgK33PNh7D8P31KWdFz3cI8pKXaDqwyEknRHbTXFnN+9zlDyFsL1RtMf0tf0S4/hRG/i/OjHpcSASxGSfePfkYvH02m3QnDNb/BNRoa6Xto1H2m0LieNUeJY8gmlMkacwIkziBLjDjjNkXSYYwJTLJYStRLGxEaVprBsYAAGm+DCyW2dAyY6amAqQFXTO1wU+jovujbs5nNRGI0NX/K70ZvQ5PbREuYmnVyEvVGUSQGuu1XAHUiimyuF z+w7EJvX Rth9tNlrsdejG8bY/bJxoCo15ytIvHtzckFMolbQFxfJhtEnPstTM3Iftj49UrevRDIfW9fq8PDbObcUj9pMLYKUF2V1zvpMykK3/lt4yRwwWwu0qJ9Puri9P4XPCJfVSmKidPqW3MTjTYYdyN+lH46rUXUtJaBI3CQwCuuFsHywMcvVbZWVMGFmlgHduKxd6Sg8BQ42l4yQewv4zY+6ok9LgAyFDWkRqUrjWST4QVDbZbsK58xQRJlLgk9/fJ9UoEVksgg5McDqkDqBuCGraqh95X9E58DpMvDfmdNZBk4+yQVWHfalDzpPhVUmdEf9y/h3i 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)" Move most of x86::numa_init() to numa_memblks so that the latter will be more self-contained. With this numa_memblk data structures should not be exposed to the architecture specific code. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/mm/numa.c | 40 ++++------------------------------- include/linux/numa_memblks.h | 3 +++ mm/numa_memblks.c | 41 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 36 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 8eb15578625e..16bc703c9272 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -115,13 +115,9 @@ void __init setup_node_to_cpumask_map(void) pr_debug("Node to cpumask map for %u nodes\n", nr_node_ids); } -static int __init numa_register_memblks(struct numa_meminfo *mi) +static int __init numa_register_nodes(void) { - int nid, err; - - err = numa_register_meminfo(mi); - if (err) - return err; + int nid; if (!memblock_validate_numa_coverage(SZ_1M)) return -EINVAL; @@ -171,39 +167,11 @@ static int __init numa_init(int (*init_func)(void)) for (i = 0; i < MAX_LOCAL_APIC; i++) set_apicid_to_node(i, NUMA_NO_NODE); - nodes_clear(numa_nodes_parsed); - nodes_clear(node_possible_map); - nodes_clear(node_online_map); - memset(&numa_meminfo, 0, sizeof(numa_meminfo)); - WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.memory, - NUMA_NO_NODE)); - WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.reserved, - NUMA_NO_NODE)); - /* In case that parsing SRAT failed. */ - WARN_ON(memblock_clear_hotplug(0, ULLONG_MAX)); - numa_reset_distance(); - - ret = init_func(); + ret = numa_memblks_init(init_func, /* memblock_force_top_down */ true); if (ret < 0) return ret; - /* - * We reset memblock back to the top-down direction - * here because if we configured ACPI_NUMA, we have - * parsed SRAT in init_func(). It is ok to have the - * reset here even if we did't configure ACPI_NUMA - * or acpi numa init fails and fallbacks to dummy - * numa init. - */ - memblock_set_bottom_up(false); - - ret = numa_cleanup_meminfo(&numa_meminfo); - if (ret < 0) - return ret; - - numa_emulation(&numa_meminfo, numa_distance_cnt); - - ret = numa_register_memblks(&numa_meminfo); + ret = numa_register_nodes(); if (ret < 0) return ret; diff --git a/include/linux/numa_memblks.h b/include/linux/numa_memblks.h index f81f98678074..07381320848f 100644 --- a/include/linux/numa_memblks.h +++ b/include/linux/numa_memblks.h @@ -34,6 +34,9 @@ int __init numa_register_meminfo(struct numa_meminfo *mi); void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, const struct numa_meminfo *mi); +int __init numa_memblks_init(int (*init_func)(void), + bool memblock_force_top_down); + #ifdef CONFIG_NUMA_EMU int numa_emu_cmdline(char *str); void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys, diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c index e3c3519725d4..7749b6f6b250 100644 --- a/mm/numa_memblks.c +++ b/mm/numa_memblks.c @@ -415,6 +415,47 @@ int __init numa_register_meminfo(struct numa_meminfo *mi) return 0; } +int __init numa_memblks_init(int (*init_func)(void), + bool memblock_force_top_down) +{ + int ret; + + nodes_clear(numa_nodes_parsed); + nodes_clear(node_possible_map); + nodes_clear(node_online_map); + memset(&numa_meminfo, 0, sizeof(numa_meminfo)); + WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.memory, + NUMA_NO_NODE)); + WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.reserved, + NUMA_NO_NODE)); + /* In case that parsing SRAT failed. */ + WARN_ON(memblock_clear_hotplug(0, ULLONG_MAX)); + numa_reset_distance(); + + ret = init_func(); + if (ret < 0) + return ret; + + /* + * We reset memblock back to the top-down direction + * here because if we configured ACPI_NUMA, we have + * parsed SRAT in init_func(). It is ok to have the + * reset here even if we did't configure ACPI_NUMA + * or acpi numa init fails and fallbacks to dummy + * numa init. + */ + if (memblock_force_top_down) + memblock_set_bottom_up(false); + + ret = numa_cleanup_meminfo(&numa_meminfo); + if (ret < 0) + return ret; + + numa_emulation(&numa_meminfo, numa_distance_cnt); + + return numa_register_meminfo(&numa_meminfo); +} + static int __init cmp_memblk(const void *a, const void *b) { const struct numa_memblk *ma = *(const struct numa_memblk **)a; From patchwork Tue Jul 23 06:41:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739449 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 8E5D6C3DA63 for ; Tue, 23 Jul 2024 06:46:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 179D96B00A9; Tue, 23 Jul 2024 02:46:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12A536B00B9; Tue, 23 Jul 2024 02:46:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE5146B00BA; Tue, 23 Jul 2024 02:46:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CE4FA6B00A9 for ; Tue, 23 Jul 2024 02:46:27 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 913431A16B9 for ; Tue, 23 Jul 2024 06:46:27 +0000 (UTC) X-FDA: 82370083614.14.4894920 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf19.hostedemail.com (Postfix) with ESMTP id 5D8BB1A0013 for ; Tue, 23 Jul 2024 06:46:24 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mh2GRPm2; spf=pass (imf19.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717162; a=rsa-sha256; cv=none; b=31lEs9BV9ZZXFgtJ5NdeOeFCy4wtHVn+6dwvnD67qKgECJyUex55wPAjnVGte+mdG7SrBv Me4PmYDFVufzlO5Pu3EEF/LM8aNcJFOry8d9+vvZ1zO4EyNMaEBvEjSMuXO8X/S6l5jc5h q38M3eA0IBgb+YjVv1zE+ndNwT3WXKg= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mh2GRPm2; spf=pass (imf19.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717162; 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=C3dNS8tmm9LuMgkByeluGpiI0uqfkNWTjzixbc7jZLI=; b=JhKdbTkRkmZfUjq0KSRRAoaNPMgtTovBn6sin1xgKdvDXAWGqXy8YC66Zw6yzdeUqjP0Un SAbGIOgUJwTTVn5FMrBo8r4q+Kt/liIb69xYFHuK2yCMhyKvzmlT1Y2rRhokZJjrwSjW0Q rlCW3hCV2a4TBOHBxnPNELJ6XGT24iU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C13F8CE0BBB; Tue, 23 Jul 2024 06:46:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17035C4AF0C; Tue, 23 Jul 2024 06:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717182; bh=czQlSB1prAUx4+nfVbpfC7vYMDzPDxbO3yiJDWAcvGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mh2GRPm2wBte19heLPPhCf25v4O8wId4t+XDdcLCfWpGv5PTkhss9ReUL8uazZULe 6eM8hQ+PWHhFnWT76FwkX2NWIgKyOpW3GylcxSfAvHhs0N7B5LuvANwWeCeqv+0nDx mhNPH8UgkiWp4VYIHXnZ1B4AFRHWcZw1ZlNwvtOAL0/JWEF+dZaXAkCexbuQgF77Kg MPc24q9PrvJh/gNzTjBu1XTMLLkvq6W+vGcmjsVIS4dX2Fgk3Bp7HPWIm4OA0YwdlJ shJ43oMYTjLQ/vbrZALQOA/kooXYb1d27NgGQfNNeu69CkjqYV2KsWm0OQI46bPrqY tFWPaODMjuktQ== 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 21/25] mm: numa_memblks: make several functions and variables static Date: Tue, 23 Jul 2024 09:41:52 +0300 Message-ID: <20240723064156.4009477-22-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-Stat-Signature: wy9si1tpny1ypgw5y6h3df9bjn1mbffe X-Rspamd-Queue-Id: 5D8BB1A0013 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1721717184-867089 X-HE-Meta: U2FsdGVkX18X1cMW4jiD3XHrxELPCX1QwL73gYCiUsOLBqS7mVNh73Ggap1x8Yj5FSjfqavG3tnBbSYRFrkI4Rountl88tp58yzaAmnu8AZ9SBQJcIpmUVhjN1BTD/wHWwd4OSex5MFlIx4G2MKFRDLrIdF1Bgb17nL4GdLXYrRrwPckKhHqtAkzHkrkmhLyhWTV47rbV5+zPEoMDZ3flbk6qPHV5fYtCWYqE0QgO8wH4P3fxyBRTtQIqjcEM1a/klxYqBUkVk7ls03W7IBN6WHYOTyvMnphqn8kKJqEv9wnIe1yoxt3J5kv/p9IZLS1QPN/OTBLpzSN1EXXFWliX26Flm+somrk11EEx11R1YL32VIzlC5/36ots64Tl8j6AB1xKoYJWln/JpVg4/FE9AqYhtRqb2KK6OqvFoclUUrxyrJsVC3mO3pxl6IBQK9EJ+HHUdS/wOSWd5043+petM9v570kgwTr64vVGHX2kN119pvO7eRWYz4bT9/vKrm/RLlOFNGwg8PdmtYLt5GLZXXMmmJy83tGEMXqT0Bjh61OKoD32OAIpeAqZrlrTt6ioSzrz/+fe0mNad7TB54gpXWjSmxEeefEcR1iYb7OC0oUAV/F9SgzbrziIQdNj9V4LztQWQs5kfEh6eZJmiuQcPvaGx7qkeLZv2niRB/7ElQiFFXg5rCs9XFpzFBb1Sdj/lME2oq44yrii9MXnfEZe7KVgOzm7DoCkg2AGEocN3V/+NZJVkOwfIOe6fMJskEEnUaLiY0lyyp4Aj7dZiB4vx2lzu60yWxyZitY0dIsT3MrJTpEUNVkQHf4nCr+ufXFguVOAvO3g+HjsZzC7BA30E+LFzDG0iZN/d7FBbRrEbsW68FkPNQcXm5LKixkIKHvURAFZLHpwYgMGoqjkoq7XxMuGa31jgRDQkMPifGcLuS1R9BGcJI0vJ9/oOFAxXGVtD1gm7Jhjj0uzyiKLqQ jIdrR6BQ ou7M2aws3S1PniklyEpOmdU5thXb9QPZFJ+jeBNGi0Br/7FuA4x/quSZh75NWI3vqNrLU26qK9oX7z4EZDRvAjR8L5UKziNSovCe1k4dcpHMSy+/ji4imszKD1C3FC8Z5G/Fd36SWl4lS0jXjadgF0xiSTj9eB5OgLYMNtSU7zPw6fBybtGezQgj0oo5r9rIhnF51g5Ds9dBfy1yvQt24XcX0D1DfEx+1Knk1sCzdH7WEdLAququto7kULzYI8exqTq2xnSa0FQ2mqXq8UYv3LfpJE0l+CT9STFhsrPrHxYsKEelntWvwC0itbVRlUPFMtfc+n6YSosD2QQ7NykIrk5tFwEyHDw59jGmmTP45S1+MBmo= 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)" Make functions and variables that are exclusively used by numa_memblks static. Move numa_nodemask_from_meminfo() before its callers to avoid forward declaration. Signed-off-by: Mike Rapoport (Microsoft) --- include/linux/numa_memblks.h | 8 -------- mm/numa_memblks.c | 36 ++++++++++++++++++------------------ 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/include/linux/numa_memblks.h b/include/linux/numa_memblks.h index 07381320848f..5c6e12ad0b7a 100644 --- a/include/linux/numa_memblks.h +++ b/include/linux/numa_memblks.h @@ -7,7 +7,6 @@ #define NR_NODE_MEMBLKS (MAX_NUMNODES * 2) -extern int numa_distance_cnt; void __init numa_set_distance(int from, int to, int distance); void __init numa_reset_distance(void); @@ -22,17 +21,10 @@ struct numa_meminfo { struct numa_memblk blk[NR_NODE_MEMBLKS]; }; -extern struct numa_meminfo numa_meminfo __initdata_or_meminfo; -extern struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; - int __init numa_add_memblk(int nodeid, u64 start, u64 end); void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi); int __init numa_cleanup_meminfo(struct numa_meminfo *mi); -int __init numa_register_meminfo(struct numa_meminfo *mi); - -void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, - const struct numa_meminfo *mi); int __init numa_memblks_init(int (*init_func)(void), bool memblock_force_top_down); diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c index 7749b6f6b250..e97665a5e8ce 100644 --- a/mm/numa_memblks.c +++ b/mm/numa_memblks.c @@ -7,13 +7,27 @@ #include #include -int numa_distance_cnt; +static int numa_distance_cnt; static u8 *numa_distance; nodemask_t numa_nodes_parsed __initdata; -struct numa_meminfo numa_meminfo __initdata_or_meminfo; -struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; +static struct numa_meminfo numa_meminfo __initdata_or_meminfo; +static struct numa_meminfo numa_reserved_meminfo __initdata_or_meminfo; + +/* + * Set nodes, which have memory in @mi, in *@nodemask. + */ +static void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, + const struct numa_meminfo *mi) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(mi->blk); i++) + if (mi->blk[i].start != mi->blk[i].end && + mi->blk[i].nid != NUMA_NO_NODE) + node_set(mi->blk[i].nid, *nodemask); +} /** * numa_reset_distance - Reset NUMA distance table @@ -290,20 +304,6 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi) return 0; } -/* - * Set nodes, which have memory in @mi, in *@nodemask. - */ -void __init numa_nodemask_from_meminfo(nodemask_t *nodemask, - const struct numa_meminfo *mi) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(mi->blk); i++) - if (mi->blk[i].start != mi->blk[i].end && - mi->blk[i].nid != NUMA_NO_NODE) - node_set(mi->blk[i].nid, *nodemask); -} - /* * Mark all currently memblock-reserved physical memory (which covers the * kernel's own memory ranges) as hot-unswappable. @@ -371,7 +371,7 @@ static void __init numa_clear_kernel_node_hotplug(void) } } -int __init numa_register_meminfo(struct numa_meminfo *mi) +static int __init numa_register_meminfo(struct numa_meminfo *mi) { int i; From patchwork Tue Jul 23 06:41:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739450 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 F16FEC3DA63 for ; Tue, 23 Jul 2024 06:46:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80A736B00BB; Tue, 23 Jul 2024 02:46:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 791E36B00BC; Tue, 23 Jul 2024 02:46:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60C0B6B00BD; Tue, 23 Jul 2024 02:46:39 -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 40EEA6B00BB for ; Tue, 23 Jul 2024 02:46:39 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 06F901C3AD4 for ; Tue, 23 Jul 2024 06:46:39 +0000 (UTC) X-FDA: 82370084118.05.49FDA5C Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf14.hostedemail.com (Postfix) with ESMTP id 0912C100009 for ; Tue, 23 Jul 2024 06:46:36 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GdtNpb5f; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717174; 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=IquVUnaSssq0FhtsngEdD0WtFGUdOiO21fxX0Knf6UU=; b=aFZQE7UKMf4T98EWTNWCInniUyuc048xbxravacdxL0P1HOgqYIR3ZefzmsBSrr8BEvRQZ iSRgumowwXkq1SYcwi233aRtK5xKRL9zvyLUwIF2HzW2lnkI3ldn8O2XvgLx5wxuNG8sdX AR5ETon6stab77T5q+JG1OSTJnLuBtk= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GdtNpb5f; spf=pass (imf14.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717174; a=rsa-sha256; cv=none; b=37RA0hyf+BvBDjOGihBJYcsSQEtQ8qNt3mbhG5vMtHIaZWuDJnNcHUl340oP3eM6nlco4N 57VzQplYI5ETB/MqssqxcjvH9lb2RUaWPgQFeZ1UyIWv2lfXtMBGszYF7Mgqy877nZvCOs EcyRj3pFPkmjDerPJL/FxMTym3c1ho8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5B0A6CE0E07; Tue, 23 Jul 2024 06:46:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E983C4AF14; Tue, 23 Jul 2024 06:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717193; bh=zVDs6WKjT/YvUD2GuaqovEFQsz1PVdi+2wlgjwoVKBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdtNpb5fUIpXsX9U29NSh04YZWODgndxZxjste8kTAvvVKauwF6UNM6S9Dr3BCKEs yzF3a95E4FDYjaodsPNzYMUIiAFluD4W6BzfRkWMXJaN5mJiDqA0nbhJUlVN8YBreY N8Lfe55rcuYatNFvDLpb1o/ai1cq2a87KFY1vXc2G3PokM+pzDBZiGx1YYc0JvUIwd hD+FxT+d7coc5Nv4te6g48WPgLLOAIBVm7uSHK4G4+cw6nfe/xZpmv2v/wDAZjLxfx maJJGo9Hlb/cksHiz+XhQBIYl3hu/DniwedBxjLUcBhi+OlRUy+RXddlr9a1o66hWz zfdJosOcK+iJA== 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 22/25] mm: numa_memblks: use memblock_{start,end}_of_DRAM() when sanitizing meminfo Date: Tue, 23 Jul 2024 09:41:53 +0300 Message-ID: <20240723064156.4009477-23-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: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 0912C100009 X-Stat-Signature: z8d47ibezfb9u8sh1xqm537ut1938qkc X-HE-Tag: 1721717196-77061 X-HE-Meta: U2FsdGVkX1+iSZOm1cmfdXkBlRzQN4Q1tjIph4qRPxoyLc4PcT1b8PomPkZSSswQDzKct6iqQqTqvnc5bI6ws6UKHA8DXUKYf2x3T/mnVl22BMTaBo/wjWVER6PMvny+BHSMNrhnbOSEwc5ZdElXBrc3rnRadyDdW8XEluirs18n5yCVSDdQpLdhiLg5SsZO9da2BHD29nwpJi8Ynp7ZnXjWXAvPAY1wCiAowd+Sb1nF+4T4Lm0oM38b80jfJTBti8BWV4LIaq9hHtjQhKLVTnxVK1ptMh2IpCWPFJVgdUoy8hGA79paHc+/rvDnQEcB83TUkNaUrXr1fsC5Ciuwd2rvIBE0+BGO/opoyQl4nnQsglP3VhhrTUs8cn1025LktZ7II6d2K7KiCQafx+zAYayyVDE0bVGlqQL1XYYhV3RvzOs4abSIDrjjOSf5EIY+lzB52UUWW4AP+wbfAb/M1I7tggzU14/uVVJUT+ANPZoYQZXQl99Ll1cIpQRyK+0IjJflquOTdzOyg0+dbl8onDDCfC/xpe4eBlq6ANvFH5o7eacTGoJNRbWImWQPncwzt10drR+o9TaV10Ysb/MNf7iCm2NekkJnvPVbqoUzWOnapr4roFhOoEFPF2JR7Xb/QgPgkzTUXvsspL6DjDntSwdahN3iWlC/6v6PoTuDxohbcyrmvRbl0NAvGLwsHutn52OeOQ6xyp8b8P7R/oTbMZytyY2bJCmmVT0sMYJQBfMXoxkKRQJBytS+gCGtmD6bEq//FGPOT6ob8Ym3xTS1voVG+HYPXSJ6Awdh7935NRxZe8oYHA5MDQfIZU00QMvHcnDNdcSK1UX+ilGUFJbn7V3NW5WK1McKcrGgOQiQuZNyXh7ZIfC38WmbVc9akvetSolyCXl8ScKEDq5m1F/kxl+4iJdCIroRcOIiHz8KcrE9bhnpZB0rlFz0smMeodU1690yDoYr5O7hQdomM6p UVEwSXqo xP6S6FdFg0EI3cd3SXgRICaBV9B82e+CEPdeNRr55KM7PcY1LMWMKRDFPmtby3PTabt+EvjgDruhkZ8Dy9p8eIolOvvA1aigCskYmVSCyV25I46WTbJHYi6MwuCZ/Vub2DCRs9Efpj5d6xtlNinmpunhMLzPSe+RUabZiBtbnZk+IHzN1QFvgNq9trzNxPl1PwtKctzqdhzz/vjV16mnEkr0QyU924WfyS4AThC00hMHgwBsjwkt1KhAoe6mjcdNusRzaI9JZfd9TlflJV+LOULvhzppASTbPmtQiI5I5NDo/R/+C6eITCcpo0BPbn3b6m8NB 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)" numa_cleanup_meminfo() moves blocks outside system RAM to numa_reserved_meminfo and it uses 0 and PFN_PHYS(max_pfn) to determine the memory boundaries. Replace the memory range boundaries with more portable memblock_start_of_DRAM() and memblock_end_of_DRAM(). Signed-off-by: Mike Rapoport (Microsoft) --- mm/numa_memblks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c index e97665a5e8ce..e4358ad92233 100644 --- a/mm/numa_memblks.c +++ b/mm/numa_memblks.c @@ -212,8 +212,8 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) */ int __init numa_cleanup_meminfo(struct numa_meminfo *mi) { - const u64 low = 0; - const u64 high = PFN_PHYS(max_pfn); + const u64 low = memblock_start_of_DRAM(); + const u64 high = memblock_end_of_DRAM(); int i, j, k; /* first, trim all entries */ From patchwork Tue Jul 23 06:41:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739451 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 06AE0C3DA49 for ; Tue, 23 Jul 2024 06:46:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CD076B00A7; Tue, 23 Jul 2024 02:46:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 861676B00BD; Tue, 23 Jul 2024 02:46:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CEFE6B00B0; Tue, 23 Jul 2024 02:46:48 -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 4C9C96B00BD for ; Tue, 23 Jul 2024 02:46:48 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0726DA1C5B for ; Tue, 23 Jul 2024 06:46:48 +0000 (UTC) X-FDA: 82370084496.19.45F0FE2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 586F420005 for ; Tue, 23 Jul 2024 06:46:46 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aifPEDXD; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.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=1721717154; 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=YwxCyFvpvd65E3n7xZa02al8cyZcfR+th7BShgSPqtI=; b=G6JqjgvRXftK+i9EdJ+mAQGa3HqrZctKx2s3K+3HKO5fOnDmQ8gzgQvijhKUOSYsaCbK8U fTRr4aSEwhTjVxBx4GJUpWWjRtNi4CjshNiSP2LRJl6ncFXPpH/NBySPA/QvAR9K0Ra0xI OYBV30k2qCUJygK4kxSav08iKvsVafk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717154; a=rsa-sha256; cv=none; b=YVHkfKmxQnSqefjEOysNOR+YA8eBvP6ZxIwwLzAXlT1Wuuyi9a2eCdroZ4EST6wNK/phdi oESGQUQ+8bFU1CjpzZmAWCfZYIbvv+7E8s+RhTN4u/WowYHCt/c5QmUC8hxo3DAeKIRX0f mRL/vYg4CYvioBRJ08Smhc+MNztHyNk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aifPEDXD; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf13.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 8667460187; Tue, 23 Jul 2024 06:46:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3718DC4AF13; Tue, 23 Jul 2024 06:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717205; bh=Mej9sxLQixWGdmK565gFwBx2ByPl7rtL0f0ZPnxf/S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aifPEDXDJfm59czghgzqn6gX2srkwMHjj0MDAYduHgsQYt3LGdewFa3vOyK8Dkumz 1HAs5r4jvJXbol55lz55vqk9ZcNeBu4vBBYJBnf5DTsEBF3Q6tPKOkOPEER240Uw29 4Gk6WKAuZBstvMWa7OmmJIJmjg37tfJXWJ9rKS3Q7lObr6Dd2VwwdoPNdtfsaGsdI2 vV0zrCVw7+zwfqJ/kHdVhStrolfdNSESoJho0dXlPRHtSnDLZia3RoJwCZ9oKUSo6C JEqAEo3ng6ENYfKRpvmqa4razDCj+uioqxOiis3qh54kCu2BTqAMZVkdqr5+j0zQ9z fWe8vNWTVnDlw== 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 23/25] arch_numa: switch over to numa_memblks Date: Tue, 23 Jul 2024 09:41:54 +0300 Message-ID: <20240723064156.4009477-24-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: 586F420005 X-Stat-Signature: qdg3cu579p4bd1168jm9mygtz4ep41f7 X-Rspam-User: X-HE-Tag: 1721717206-690258 X-HE-Meta: U2FsdGVkX1+a2AiUiZ1qYAGjFigtQ+jhPqqFCJ/qllHuVM5wTO+ZCM8FIjQd/lwnbrWQIa/boy8zLhG1widjJh+VOrEvJ9hXf1gwZrRAonSBbPq6UUM1HDobJneaY/PCOG02qL1uICO+MWsDBTYhpRsh27ltEPur+34OnpiMHN1pCD0OvaVHvDC4A2C5WmHTFLQRtyCsX1LaTyBb+lislMCad1NOii3grtU0vU3XKsY8jJ+4Zj20YZz0skFLd5VZZDW232SC+iXd8nTBCMf4N13gXdsrAklK6KGVU9g5NFLEUenti8lsP5rZOvePd/snsB/Lq1BUM8Us0RXBgAJI19KQzEueKne36CmUl2P+jhiYzUDqy1YC0NlU960IvjyKYYHd1Ic4f830OvUerHViImYY+hBP00n+fxF6kfkq9D3LPL7VpdZaAumuNQciDobFtNgD8q/hkPDuh+s/s5b6ikSyqNP0anOZBS8EYSA95QTEu17fAyFQJ27jz180WJ0uC3I/VImXRv4oKTnBnJ3TDuMY6nyx0QaiXr7KOafwvayv8s1vMTy2MIHNDG6fuJ8zvHAvusNovZ6T8+h6eT35H/W4Re/DmHAcBknvglAlWPmrDne5fWTtsjBJRTlI/WcWRtOe7acdkyEeA6TjRahVV2gFrLSyrqh2LvDX8z4JyK34JCzMrrpGDxm1xHvtqEGPilBmFJOu1ye8MMWw6d3gas1Rkqh4G9FUxT2Ij/3mdMdw7eZkt3w8Pg4ajzB9i49XDe+5YemMbTTJWnmh42331TQJyZYg7X74MaPVEaMjgQNoboLNA5kTFuOAmhUdW/83pwmgJB7cJGQiCckzH8yfLddfmPq18L6AklaamUTbA0yuZOksK1HvOOef9v674kwi303V9T4nUZdzsd9dtRgGQNbJo9bGxzXk3XLuxoL1YvD2/skG+orVX2nndICgjWbbuWVDwmxG2FKQtrZxNri StXNDZes Q9vmv8tG7tkmEs/8Uq1cfsWQoSzvNWtCgdOqhJaoIAE0/c8KPDnQNVdngbneuNTomcrmDUJKOWldIT1pPq4o26ill4HCdz+6hbTEunVlfbF3sK5ZXuEhpRXqJQaEbMDTTukpPRhQioZuwkR0QJlnLRk7+gAAYjUdELfPB/RQtu5AitIMRFtX4X21HtkQBwbU7U1sQ93KxD++17QJ8rasquXjk8Bcj6hePz2M+Ft5IpDcw3vqz2AbLgNiMArPgq2u04bkfwQ7vTycxhpfpf8zy9rfc3TnFRrjrTvXdunBW83WUSYmf10fCxNsytdLa30oGbmIDTRG8QqDsDgY= 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)" Until now arch_numa was directly translating firmware NUMA information to memblock. Using numa_memblks as an intermediate step has a few advantages: * alignment with more battle tested x86 implementation * availability of NUMA emulation * maintaining node information for not yet populated memory Replace current functionality related to numa_add_memblk() and __node_distance() with the implementation based on numa_memblks and add functions required by numa_emulation. Signed-off-by: Mike Rapoport (Microsoft) --- drivers/base/Kconfig | 1 + drivers/base/arch_numa.c | 200 +++++++++++-------------------------- include/asm-generic/numa.h | 6 +- 3 files changed, 64 insertions(+), 143 deletions(-) diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 2b8fd6bb7da0..064eb52ff7e2 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -226,6 +226,7 @@ config GENERIC_ARCH_TOPOLOGY config GENERIC_ARCH_NUMA bool + select NUMA_MEMBLKS help Enable support for generic NUMA implementation. Currently, RISC-V and ARM64 use it. diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index 2ebf12eab99f..806550239d08 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -12,14 +12,12 @@ #include #include #include +#include #include -nodemask_t numa_nodes_parsed __initdata; static int cpu_to_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; -static int numa_distance_cnt; -static u8 *numa_distance; bool numa_off; static __init int numa_parse_early_param(char *opt) @@ -28,6 +26,8 @@ static __init int numa_parse_early_param(char *opt) return -EINVAL; if (str_has_prefix(opt, "off")) numa_off = true; + if (!strncmp(opt, "fake=", 5)) + return numa_emu_cmdline(opt + 5); return 0; } @@ -59,6 +59,7 @@ EXPORT_SYMBOL(cpumask_of_node); #endif +#ifndef CONFIG_NUMA_EMU static void numa_update_cpu(unsigned int cpu, bool remove) { int nid = cpu_to_node(cpu); @@ -81,6 +82,7 @@ void numa_remove_cpu(unsigned int cpu) { numa_update_cpu(cpu, true); } +#endif void numa_clear_node(unsigned int cpu) { @@ -142,7 +144,7 @@ void __init early_map_cpu_to_node(unsigned int cpu, int nid) unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; EXPORT_SYMBOL(__per_cpu_offset); -int __init early_cpu_to_node(int cpu) +int early_cpu_to_node(int cpu) { return cpu_to_node_map[cpu]; } @@ -187,30 +189,6 @@ void __init setup_per_cpu_areas(void) } #endif -/** - * numa_add_memblk() - Set node id to memblk - * @nid: NUMA node ID of the new memblk - * @start: Start address of the new memblk - * @end: End address of the new memblk - * - * RETURNS: - * 0 on success, -errno on failure. - */ -int __init numa_add_memblk(int nid, u64 start, u64 end) -{ - int ret; - - ret = memblock_set_node(start, (end - start), &memblock.memory, nid); - if (ret < 0) { - pr_err("memblock [0x%llx - 0x%llx] failed to add on node %d\n", - start, (end - 1), nid); - return ret; - } - - node_set(nid, numa_nodes_parsed); - return ret; -} - /* * Initialize NODE_DATA for a node on the local memory */ @@ -226,116 +204,9 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; } -/* - * numa_free_distance - * - * The current table is freed. - */ -void __init numa_free_distance(void) -{ - size_t size; - - if (!numa_distance) - return; - - size = numa_distance_cnt * numa_distance_cnt * - sizeof(numa_distance[0]); - - memblock_free(numa_distance, size); - numa_distance_cnt = 0; - numa_distance = NULL; -} - -/* - * Create a new NUMA distance table. - */ -static int __init numa_alloc_distance(void) -{ - size_t size; - int i, j; - - size = nr_node_ids * nr_node_ids * sizeof(numa_distance[0]); - numa_distance = memblock_alloc(size, PAGE_SIZE); - if (WARN_ON(!numa_distance)) - return -ENOMEM; - - numa_distance_cnt = nr_node_ids; - - /* fill with the default distances */ - for (i = 0; i < numa_distance_cnt; i++) - for (j = 0; j < numa_distance_cnt; j++) - numa_distance[i * numa_distance_cnt + j] = i == j ? - LOCAL_DISTANCE : REMOTE_DISTANCE; - - pr_debug("Initialized distance table, cnt=%d\n", numa_distance_cnt); - - return 0; -} - -/** - * numa_set_distance() - Set inter node NUMA distance from node to node. - * @from: the 'from' node to set distance - * @to: the 'to' node to set distance - * @distance: NUMA distance - * - * Set the distance from node @from to @to to @distance. - * If distance table doesn't exist, a warning is printed. - * - * If @from or @to is higher than the highest known node or lower than zero - * or @distance doesn't make sense, the call is ignored. - */ -void __init numa_set_distance(int from, int to, int distance) -{ - if (!numa_distance) { - pr_warn_once("Warning: distance table not allocated yet\n"); - return; - } - - if (from >= numa_distance_cnt || to >= numa_distance_cnt || - from < 0 || to < 0) { - pr_warn_once("Warning: node ids are out of bound, from=%d to=%d distance=%d\n", - from, to, distance); - return; - } - - if ((u8)distance != distance || - (from == to && distance != LOCAL_DISTANCE)) { - pr_warn_once("Warning: invalid distance parameter, from=%d to=%d distance=%d\n", - from, to, distance); - return; - } - - numa_distance[from * numa_distance_cnt + to] = distance; -} - -/* - * Return NUMA distance @from to @to - */ -int __node_distance(int from, int to) -{ - if (from >= numa_distance_cnt || to >= numa_distance_cnt) - return from == to ? LOCAL_DISTANCE : REMOTE_DISTANCE; - return numa_distance[from * numa_distance_cnt + to]; -} -EXPORT_SYMBOL(__node_distance); - static int __init numa_register_nodes(void) { int nid; - struct memblock_region *mblk; - - /* Check that valid nid is set to memblks */ - for_each_mem_region(mblk) { - int mblk_nid = memblock_get_region_node(mblk); - phys_addr_t start = mblk->base; - phys_addr_t end = mblk->base + mblk->size - 1; - - if (mblk_nid == NUMA_NO_NODE || mblk_nid >= MAX_NUMNODES) { - pr_warn("Warning: invalid memblk node %d [mem %pap-%pap]\n", - mblk_nid, &start, &end); - return -EINVAL; - } - } /* Finally register nodes. */ for_each_node_mask(nid, numa_nodes_parsed) { @@ -360,11 +231,7 @@ static int __init numa_init(int (*init_func)(void)) nodes_clear(node_possible_map); nodes_clear(node_online_map); - ret = numa_alloc_distance(); - if (ret < 0) - return ret; - - ret = init_func(); + ret = numa_memblks_init(init_func, /* memblock_force_top_down */ false); if (ret < 0) goto out_free_distance; @@ -382,7 +249,7 @@ static int __init numa_init(int (*init_func)(void)) return 0; out_free_distance: - numa_free_distance(); + numa_reset_distance(); return ret; } @@ -454,3 +321,54 @@ void __init arch_numa_init(void) numa_init(dummy_numa_init); } + +#ifdef CONFIG_NUMA_EMU +void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys, + unsigned int nr_emu_nids) +{ + int i, j; + + /* + * Transform cpu_to_node_map table to use emulated nids by + * reverse-mapping phys_nid. The maps should always exist but fall + * back to zero just in case. + */ + for (i = 0; i < ARRAY_SIZE(cpu_to_node_map); i++) { + if (cpu_to_node_map[i] == NUMA_NO_NODE) + continue; + for (j = 0; j < nr_emu_nids; j++) + if (cpu_to_node_map[i] == emu_nid_to_phys[j]) + break; + cpu_to_node_map[i] = j < nr_emu_nids ? j : 0; + } +} + +u64 __init numa_emu_dma_end(void) +{ + return PFN_PHYS(memblock_start_of_DRAM() + SZ_4G); +} + +void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable) +{ + struct cpumask *mask; + + if (node == NUMA_NO_NODE) + return; + + mask = node_to_cpumask_map[node]; + if (!cpumask_available(mask)) { + pr_err("node_to_cpumask_map[%i] NULL\n", node); + dump_stack(); + return; + } + + if (enable) + cpumask_set_cpu(cpu, mask); + else + cpumask_clear_cpu(cpu, mask); + + pr_debug("%s cpu %d node %d: mask now %*pbl\n", + enable ? "numa_add_cpu" : "numa_remove_cpu", + cpu, node, cpumask_pr_args(mask)); +} +#endif /* CONFIG_NUMA_EMU */ diff --git a/include/asm-generic/numa.h b/include/asm-generic/numa.h index c32e0cf23c90..c2b046d1fd82 100644 --- a/include/asm-generic/numa.h +++ b/include/asm-generic/numa.h @@ -32,8 +32,6 @@ static inline const struct cpumask *cpumask_of_node(int node) void __init arch_numa_init(void); int __init numa_add_memblk(int nodeid, u64 start, u64 end); -void __init numa_set_distance(int from, int to, int distance); -void __init numa_free_distance(void); void __init early_map_cpu_to_node(unsigned int cpu, int nid); int __init early_cpu_to_node(int cpu); void numa_store_cpu_info(unsigned int cpu); @@ -51,4 +49,8 @@ static inline int early_cpu_to_node(int cpu) { return 0; } #endif /* CONFIG_NUMA */ +#ifdef CONFIG_NUMA_EMU +void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable); +#endif + #endif /* __ASM_GENERIC_NUMA_H */ From patchwork Tue Jul 23 06:41:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739452 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 C0C18C3DA49 for ; Tue, 23 Jul 2024 06:47:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 571378D0003; Tue, 23 Jul 2024 02:47:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 521D28D0002; Tue, 23 Jul 2024 02:47:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C2638D0003; Tue, 23 Jul 2024 02:47:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1D95D8D0002 for ; Tue, 23 Jul 2024 02:47:00 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id CB2471A1B42 for ; Tue, 23 Jul 2024 06:46:59 +0000 (UTC) X-FDA: 82370084958.28.D835B1B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id 1FDCD2000A for ; Tue, 23 Jul 2024 06:46:57 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jgAoC+Hc; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717180; a=rsa-sha256; cv=none; b=MgHZ+cZWYENV11vBtdpMKj9x0kcxn8YylkMuI+Zmp2Z4b2xcwgUzR2VBPiZOUW+e55ONNw 6PpVvdU7GI3ONH8hiRmkaTrKWGElxZr4CHeVmbvIC7gBs2KKlFCFuKT3YNslooIGAop0PC /lqY+VMXaGXkiDA2H5+/HEarJAvMHVI= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jgAoC+Hc; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.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=1721717180; 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=sV9LLs7WokxoWYOpX4a3m2YB0FWn3Fpsr1uVqrV41eg=; b=PKI98lwCnPDQy/WjgA6ONk/2UOl2IlaI0I64gqslGbtnszwZHn3lGvr5eemOiAC8BSgQ+T NNjXc9EIf/i5egzQHt5VUn/BwxO3dG0ZrLP1WBjTKJYw16jFPE4XCWTqQpHQUg/lgeS6oh 7iJyy9zvIXhjDPChvu88YYPbht8wuis= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 533B560D17; Tue, 23 Jul 2024 06:46:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDFFDC4AF12; Tue, 23 Jul 2024 06:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717217; bh=emeCYa9405g7/z24yhBWS68KWW8+Lb3s/YOK8bOaThI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgAoC+Hcal9bWK9k7ho6yBYf06kymWVllDUMPiOaeuFSG/wojxIxKcWyED4DoWkCl ZyPnLzk1UZksRbBGs+vwS6J3QRkp5NCWUyBtV2hPxbzh2xDsZ8HA+/i+k9yezOal8u zhjJSmaqAV92XU7hpKX6nY/kRVxDgU4f5bxdcxuLSfaiLoEIwLORtA6VE/d1oMTTUm Pqc1pcChaNRo/+GbV4+lfx2+t+YfKTxY+qn5wYaSZxtCRIZx8059ZX38rWfyX1IoPG OdZJdrg7fImaUDMXuKWgBftxFVlRAZKp9u8sSnRW4s39ogVzgJG0rOPKH30S5pFCFo G7ZwK7pI1cKjg== 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, Jonathan Cameron Subject: [PATCH v2 24/25] mm: make range-to-target_node lookup facility a part of numa_memblks Date: Tue, 23 Jul 2024 09:41:55 +0300 Message-ID: <20240723064156.4009477-25-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: rspam12 X-Rspamd-Queue-Id: 1FDCD2000A X-Stat-Signature: ck55h57r7isbmfct8u7y7d5iosm4gtmq X-Rspam-User: X-HE-Tag: 1721717217-942665 X-HE-Meta: U2FsdGVkX1+0m6DNuACti90fM0oN9rlXXDZGOBEjXz1Hr2N0GW8+VOnto40l0OBHzCvx5H08e/fKATfr5PxLDXn/vSdXppp04dWcyQi/rGuLlmoSth1W3p8VMhec69xcQzcwKsmCNQS8MpEtyvyhHn4AEnPrc4y3QO9+qrY0K/6SPGVDkkK+m6eZXzA0MW5Mz9KfRky4g+M1MGMcR3fFtyvDX+k6MnkSiUe7aQsL4YBTWdD746MB1DtalowTqoKb51Ax9BHWZvcJwHAbYI6mZgUmY/5yVC3qhusaMcOpjb9JFp2iZ8Lclbo+H4GAU0dobtCCJZjzScgJRALhUC5/gfo8Qy6go+u6i27C2H8XJDmutgszMTw71FiLoyZNHM9puzWy7tcGZ65rSOFBWivrNfuu7v/w2qnH/Wub324mmF1WGRA4jPq2Gdcuy8f/YGBiCVafLPJ7dxW9qMWCfBp9GBLw2PlqY0+k2rnmp8gb6RNSZdmeb7q6wxq7mfUJPAjCBj9A9W3d9NEYT1DB96kCrE676834iMdzm+BQ+GbYvi6bCvW7zqjrNln5V52nX8imQgioFv5AWdeQu25KTezb6Ue0Bk1Lp6HD8FPVHWs1PTfLnHhePMYNZz8krkZznMcQgJMq6K4szD3FpyL5heYiqpP8YoQGcrPY00pw/GFy8ikAbljrIeKj9rgA8M4PkKhmBC9XPsgHKphHPeV7ceO481QtSc+YSvt3XZHlwrZYf207Fy2hkQaB79eVymhzgIM+/XlKp1IfXMf3GKDMNWCD0+toHxl7AzmLQk5uHP7FBOoYdz/+xc9iXcMk0/yBvVLZisYwOOUKudEJswB5OU7/0Dgzs74Ir+ehie1Hgz6iL+ZkT+d+cDkl8ULfYfFGWKzcIT9YthUjmCPunCuyMOLpyMj3sXJiqqGm5lLdn+yH1A9oIAShhCv+/Bri/h3wXdNH6T7zOfhHOYLqS3yzTOs rXGJsR+a KD/bZjyuc7ALIY4g8EbujFlvYPUQE+5njjdPSDyhfsMjEOn0skHcgCAqgXeSoUitbY501/OftBQ4oqZC/5B4piLC6opVlfjSvqOn0VrB3v2J1k3w52IRRY9PATJtoLiy5hwdKzu1KceXQbEi/0FSpPVS/awx4DnZfxbg9jl8D0C3DMZy+VuComWHcjeLLmNI+vGh0OIByLPcxR2Vgu+pvgAB0p5I2Ym9YNcGHf7W3BvMMEzc5UcqgZm4QXqOfn4rvqOEbM5KhXHpFtABJ/vpjGEt4FjqtqfmrITd8jjQ30JM72pSmmfmpZPpgLOakTYBUynGKee6368+ZVVKWbRWKdl2qRVF1eNKMDW8P 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)" The x86 implementation of range-to-target_node lookup (i.e. phys_to_target_node() and memory_add_physaddr_to_nid()) relies on numa_memblks. Since numa_memblks are now part of the generic code, move these functions from x86 to mm/numa_memblks.c and select CONFIG_NUMA_KEEP_MEMINFO when CONFIG_NUMA_MEMBLKS=y for dax and cxl. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/sparsemem.h | 9 -------- arch/x86/mm/numa.c | 38 -------------------------------- drivers/cxl/Kconfig | 2 +- drivers/dax/Kconfig | 2 +- include/linux/numa_memblks.h | 7 ++++++ mm/numa.c | 1 + mm/numa_memblks.c | 38 ++++++++++++++++++++++++++++++++ 7 files changed, 48 insertions(+), 49 deletions(-) diff --git a/arch/x86/include/asm/sparsemem.h b/arch/x86/include/asm/sparsemem.h index 64df897c0ee3..3918c7a434f5 100644 --- a/arch/x86/include/asm/sparsemem.h +++ b/arch/x86/include/asm/sparsemem.h @@ -31,13 +31,4 @@ #endif /* CONFIG_SPARSEMEM */ -#ifndef __ASSEMBLY__ -#ifdef CONFIG_NUMA_KEEP_MEMINFO -extern int phys_to_target_node(phys_addr_t start); -#define phys_to_target_node phys_to_target_node -extern int memory_add_physaddr_to_nid(u64 start); -#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid -#endif -#endif /* __ASSEMBLY__ */ - #endif /* _ASM_X86_SPARSEMEM_H */ diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 16bc703c9272..8e790528805e 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -449,41 +449,3 @@ u64 __init numa_emu_dma_end(void) return PFN_PHYS(MAX_DMA32_PFN); } #endif /* CONFIG_NUMA_EMU */ - -#ifdef CONFIG_NUMA_KEEP_MEMINFO -static int meminfo_to_nid(struct numa_meminfo *mi, u64 start) -{ - int i; - - for (i = 0; i < mi->nr_blks; i++) - if (mi->blk[i].start <= start && mi->blk[i].end > start) - return mi->blk[i].nid; - return NUMA_NO_NODE; -} - -int phys_to_target_node(phys_addr_t start) -{ - int nid = meminfo_to_nid(&numa_meminfo, start); - - /* - * Prefer online nodes, but if reserved memory might be - * hot-added continue the search with reserved ranges. - */ - if (nid != NUMA_NO_NODE) - return nid; - - return meminfo_to_nid(&numa_reserved_meminfo, start); -} -EXPORT_SYMBOL_GPL(phys_to_target_node); - -int memory_add_physaddr_to_nid(u64 start) -{ - int nid = meminfo_to_nid(&numa_meminfo, start); - - if (nid == NUMA_NO_NODE) - nid = numa_meminfo.blk[0].nid; - return nid; -} -EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); - -#endif diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig index 99b5c25be079..29c192f20082 100644 --- a/drivers/cxl/Kconfig +++ b/drivers/cxl/Kconfig @@ -6,7 +6,7 @@ menuconfig CXL_BUS select FW_UPLOAD select PCI_DOE select FIRMWARE_TABLE - select NUMA_KEEP_MEMINFO if (NUMA && X86) + select NUMA_KEEP_MEMINFO if NUMA_MEMBLKS help CXL is a bus that is electrically compatible with PCI Express, but layers three protocols on that signalling (CXL.io, CXL.cache, and diff --git a/drivers/dax/Kconfig b/drivers/dax/Kconfig index a88744244149..d656e4c0eb84 100644 --- a/drivers/dax/Kconfig +++ b/drivers/dax/Kconfig @@ -30,7 +30,7 @@ config DEV_DAX_PMEM config DEV_DAX_HMEM tristate "HMEM DAX: direct access to 'specific purpose' memory" depends on EFI_SOFT_RESERVE - select NUMA_KEEP_MEMINFO if (NUMA && X86) + select NUMA_KEEP_MEMINFO if NUMA_MEMBLKS default DEV_DAX help EFI 2.8 platforms, and others, may advertise 'specific purpose' diff --git a/include/linux/numa_memblks.h b/include/linux/numa_memblks.h index 5c6e12ad0b7a..17d4bcc34091 100644 --- a/include/linux/numa_memblks.h +++ b/include/linux/numa_memblks.h @@ -46,6 +46,13 @@ static inline int numa_emu_cmdline(char *str) } #endif /* CONFIG_NUMA_EMU */ +#ifdef CONFIG_NUMA_KEEP_MEMINFO +extern int phys_to_target_node(phys_addr_t start); +#define phys_to_target_node phys_to_target_node +extern int memory_add_physaddr_to_nid(u64 start); +#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid +#endif /* CONFIG_NUMA_KEEP_MEMINFO */ + #endif /* CONFIG_NUMA_MEMBLKS */ #endif /* __NUMA_MEMBLKS_H */ diff --git a/mm/numa.c b/mm/numa.c index 67a0d7734a98..da27eb151dc5 100644 --- a/mm/numa.c +++ b/mm/numa.c @@ -3,6 +3,7 @@ #include #include #include +#include struct pglist_data *node_data[MAX_NUMNODES]; EXPORT_SYMBOL(node_data); diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c index e4358ad92233..8609c6eb3998 100644 --- a/mm/numa_memblks.c +++ b/mm/numa_memblks.c @@ -528,3 +528,41 @@ int __init numa_fill_memblks(u64 start, u64 end) } return 0; } + +#ifdef CONFIG_NUMA_KEEP_MEMINFO +static int meminfo_to_nid(struct numa_meminfo *mi, u64 start) +{ + int i; + + for (i = 0; i < mi->nr_blks; i++) + if (mi->blk[i].start <= start && mi->blk[i].end > start) + return mi->blk[i].nid; + return NUMA_NO_NODE; +} + +int phys_to_target_node(phys_addr_t start) +{ + int nid = meminfo_to_nid(&numa_meminfo, start); + + /* + * Prefer online nodes, but if reserved memory might be + * hot-added continue the search with reserved ranges. + */ + if (nid != NUMA_NO_NODE) + return nid; + + return meminfo_to_nid(&numa_reserved_meminfo, start); +} +EXPORT_SYMBOL_GPL(phys_to_target_node); + +int memory_add_physaddr_to_nid(u64 start) +{ + int nid = meminfo_to_nid(&numa_meminfo, start); + + if (nid == NUMA_NO_NODE) + nid = numa_meminfo.blk[0].nid; + return nid; +} +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); + +#endif /* CONFIG_NUMA_KEEP_MEMINFO */ From patchwork Tue Jul 23 06:41:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739453 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 2DDD5C3DA49 for ; Tue, 23 Jul 2024 06:47:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC9168D0005; Tue, 23 Jul 2024 02:47:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A52158D0002; Tue, 23 Jul 2024 02:47:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F2C28D0005; Tue, 23 Jul 2024 02:47:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7006E8D0002 for ; Tue, 23 Jul 2024 02:47:14 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2CAC341C15 for ; Tue, 23 Jul 2024 06:47:14 +0000 (UTC) X-FDA: 82370085588.06.FC4B9A7 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf05.hostedemail.com (Postfix) with ESMTP id D0ADD100006 for ; Tue, 23 Jul 2024 06:47:11 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QNLg86Jy; spf=pass (imf05.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717187; 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=Lgfd2RQYBWtbTdajm1wMgIZOs/FA2ydup5xh3QKNe1U=; b=HUrskyLrDKby5nEsJ6cVJokx3PvCPKvFKauD4cN1vo2AI6AzOzaExgozmtbZqaYOAywrVQ KJZjWP1JDF9RXipjyTF+sjCCn6RY6hSjyHXRg5ZsXYlnH0mYjs2jlrKet2o2tIOoO6Xnjt yI46hQGswunwr7hoeqMqMOBpfhgI6ck= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717187; a=rsa-sha256; cv=none; b=1TcrHfjqANlYrDUpz+eAz+KnHrHvzxKVGGHcdx6Y2orKCRuEnIlan89fLXd43VwYV4lksu p/YFBQX0EC5bD4ejbpd0cU2KKRyTA6uB7g80/y5NmXknHqRVz/T915+kXKH8/lgwntlkRK Py95PXaaKbRbl+QBqO3ai0lBHo9lsDY= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QNLg86Jy; spf=pass (imf05.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 412C2CE0DA0; Tue, 23 Jul 2024 06:47:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88E7AC4AF10; Tue, 23 Jul 2024 06:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717228; bh=XhBFop5H8bMuMnCv+pTVRkvsNA1D1d9rM83bQqfOsbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QNLg86Jyt1YyzxPEeX6D3F4KpgxoIA7kTTXU/4Vh40COSg2P7gWaFbk2wTlGFfl4o 8VEFN0QnIMlGVDL9MQTFK1P9wKPcdxA6llZjn9naPajN8ELpS3/Hl6z/d8bIhTz8Bo crTLjwLalT1F0qF/XNoilpQdEa5ncV0aAZ/SpaB+6WLDO664rMOj6P6DtDnIvhdGiU c2Pr42NhZgqI9ZRisEeKX6Fejq+BKDo4BMOie7hVHOHzopjON0xM1GAA3kppApeLKE /0wmyOuJJNxXMREyX7/3OLD4TIDGDkn7CPLTl9q6nZ36lvACr6Abe1/mdtFq4g6M3X VaFW/sr1c5HuQ== 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 25/25] docs: move numa=fake description to kernel-parameters.txt Date: Tue, 23 Jul 2024 09:41:56 +0300 Message-ID: <20240723064156.4009477-26-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-Queue-Id: D0ADD100006 X-Stat-Signature: bqkqa47mefjgpzkttod3z8t1gjqgb84y X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1721717231-125441 X-HE-Meta: U2FsdGVkX1/qAagN1HpSdKXsOHiwp7bpoO4nyS5xdwNC0HP5sk9cLFfWHmoeCFxQL3gz5ZhlNwI/ZHtCPcxgIsDymalJFuiDB6k/VJpW+6pLNiBNkc/TQBerZ77VAO+wMo94YaS4Z+0vE/0F9gJMcqfN3qyioR0IO8meJj57v5ub2LQYE3zIyEjck6xpSoWkJiVcsQ0kZqQbhn39UW4P0lc7yumZloO6sk/WfgzZ8+7ywCeGa+Et/B80XYokyRhLAfRDKEWEOwe0HmpXuhFWkwrvf8yANdVC2ZKj4np1oXwVsYSC3MHav4VJUeSWEMvmRkzKFTnkJYC+2eRdqR0zslKzLvZTx/m+nirvf0QQiDogJDalka5pKHik+CdEYgeTe41s0FoMaKu7tTJZJhbXQaW802xfTrghr3CUlfdOkPyy1CkOcrXh2o2WhAQkU4N9gMo2bCTLAY2uwSae0sJh9z9yiyJt9xKN/F8E4IHeRnQgqGIQ8ksrs8iJYuznTesLJ1Cc5S4KrlzuKIm8TDs8OKbppaMwqCJQ+Rv3MvobB0sc4mBsAoh26XXlfsUMjO4zi4bgV5Xw1K+ms7/9NZ/C0GHZhmQSFzkpK86+yQo97h18Pwy0nGlwWQpFrPsPgM5ngOrnL4VKsCxyTVVGB7OOp9gqdcT5XsR/NClxfrRO+Ghg7dtygze4DMcXM+Yob//BegR2eGwcNmz44FpHLBDyVkh8DxkJDUYJS3lfNuGbwtvmspP5+PiL9fSY4eKVZB9TOtEUGpmsRjgstZBXhEWKtKLKTyfTfqp2J/tuiiRy3ifP+qLgdBxQjekxFZz68JmrEv580jfjEt/JqKt2RDlvXHpchRMH+wmDhrsfwdhQ3LcJT7m6J+T+6EJkuciybDoheKo7uwN3WTg80Vi29MVGR5rXITpugn7Dy8obGXH7sjyjIKMloeMxGNoKIrr4R2ppDxihyCDmOIQSgsNEBOC Uqza/Otn F0jk2LD6Tj6AfMjdGXaptRtoMlWXXi6TNlG58S4+3g00I3urS3bttU1NB26szZcwjoBrIudHBNXv8M031iDHtceRiHLlapeNwKhKUmcAHvcWH9xa2QVkyPKzLCQan573Ge5FzHgGmL+rgSTIAzUKk9yQnrh1XoSS+k7vOmkDjV6RRQyMUJYhOJommf5CFyC9fDyVDpzTsl13a5jEa3POKVUJ/HbfD1vWpA7fh4UagAxSYJxpHfG4YUnUF3YQVTcWBUddsE03QZ2vIMvjh+QNsaRh0p2TRFTOPnTpdd3kB/8mjGes= 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)" NUMA emulation can be now enabled on arm64 and riscv in addition to x86. Move description of numa=fake parameters from x86 documentation of admin-guide/kernel-parameters.txt Suggested-by: Zi Yan Signed-off-by: Mike Rapoport (Microsoft) --- Documentation/admin-guide/kernel-parameters.txt | 15 +++++++++++++++ Documentation/arch/x86/x86_64/boot-options.rst | 12 ------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 27ec49af1bf2..d64e27768429 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4158,6 +4158,21 @@ Disable NUMA, Only set up a single NUMA node spanning all memory. + numa=fake=[MG] + [KNL, ARM64, RISCV, X86, EARLY] + If given as a memory unit, fills all system RAM with + nodes of size interleaved over physical nodes. + + numa=fake= + [KNL, ARM64, RISCV, X86, EARLY] + If given as an integer, fills all system RAM with N + fake nodes interleaved over physical nodes. + + numa=fake=U + [KNL, ARM64, RISCV, X86, EARLY] + If given as an integer followed by 'U', it will + divide each physical node into N emulated nodes. + numa_balancing= [KNL,ARM64,PPC,RISCV,S390,X86] Enable or disable automatic NUMA balancing. Allowed values are enable and disable diff --git a/Documentation/arch/x86/x86_64/boot-options.rst b/Documentation/arch/x86/x86_64/boot-options.rst index 137432d34109..98d4805f0823 100644 --- a/Documentation/arch/x86/x86_64/boot-options.rst +++ b/Documentation/arch/x86/x86_64/boot-options.rst @@ -170,18 +170,6 @@ NUMA Don't parse the HMAT table for NUMA setup, or soft-reserved memory partitioning. - numa=fake=[MG] - If given as a memory unit, fills all system RAM with nodes of - size interleaved over physical nodes. - - numa=fake= - If given as an integer, fills all system RAM with N fake nodes - interleaved over physical nodes. - - numa=fake=U - If given as an integer followed by 'U', it will divide each - physical node into N emulated nodes. - ACPI ====