From patchwork Tue Jul 16 11:13: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: 13734335 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 E081AC3DA59 for ; Tue, 16 Jul 2024 11:15:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 738EA6B009F; Tue, 16 Jul 2024 07:15:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E85D6B00A0; Tue, 16 Jul 2024 07:15:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 561846B00A1; Tue, 16 Jul 2024 07:15:31 -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 34C8A6B009F for ; Tue, 16 Jul 2024 07:15:31 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5C526A4F58 for ; Tue, 16 Jul 2024 11:15:30 +0000 (UTC) X-FDA: 82345360020.28.4D0E5C9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 80C3940009 for ; Tue, 16 Jul 2024 11:15:28 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=URbAiLv8; spf=pass (imf11.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=1721128491; 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=n3zGa4nacsbBJXSOfEQISOWNqxdB+lCQQh30s7NcvRc=; b=C8sxIxEsChpeSm1gwbDLXEsfVS0LYvppWY0gGolBSjvvrph0E/NFpHva/alnYsZ7eBLJaF 3Ab6phyleXY+mCt8OKTs0Kt7hbXeMlcwnCMcQ9BQtnTq9Kalz5A87ygC66xQnu0FORJtl4 UslSOm5mvtVZjMOFBE3R0xczUAwM3b8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721128491; a=rsa-sha256; cv=none; b=T0CKSFvBlAlm5WB3W/PGXo+IMcEJk+iunrjj3FE5Zg1x11tagJDc73GdJjeC2drFwfixXs dHr5xK3ANYkNb2a99aUmQG5b1YRM3z40MUDgV9EiObU3TM2o7Ble5pGB3k+x75yAQkSZHY 9b1ig2XD1dyumCqRYeXvouv+lDsD0V4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=URbAiLv8; spf=pass (imf11.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 B711260304; Tue, 16 Jul 2024 11:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEF0EC4AF09; Tue, 16 Jul 2024 11:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721128527; bh=R1HYu/q0PoN2gQIJtANqh+F+EoZWMXY7KpfVYIoY6/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URbAiLv88ym2VS9Q58AhtnAFyrGYaubMDdKwbWkdIbHr3INoicWooyiqij2rcGTHT +4uVloqcrFWaKgkSVLwOi2GKWFYn79atdQgv0rNsp4t3HskUvXzhm0udxqwJRAWgrE O98eH7xSow5aI9/ojq/n8x1XfHWRoi+5IFptPwgYdPgBmnR3VVIouaFE6RZYlnzcCQ nzJbMcAu8TmI6JplcHPmnjMiIGd3JROQVFdBUnF9BTZoKr7zwu+DlOC00OgoRrCDFF SUZ+vTsVTP+36B1NwfZzzR2+vh+gCVMYEJgMrxrB5OWAAMROR5TkqKDI5IJqTrTnED 8D9sGaOuF7KRA== 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" , Greg Kroah-Hartman , Heiko Carstens , Huacai Chen , Ingo Molnar , Jiaxun Yang , John Paul Adrian Glaubitz , Jonathan Cameron , Michael Ellerman , Mike Rapoport , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Thomas Bogendoerfer , Thomas Gleixner , Vasily Gorbik , Will Deacon , linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, devicetree@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Subject: [PATCH 08/17] x86/numa_emu: simplify allocation of phys_dist Date: Tue, 16 Jul 2024 14:13:37 +0300 Message-ID: <20240716111346.3676969-9-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240716111346.3676969-1-rppt@kernel.org> References: <20240716111346.3676969-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 80C3940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1wO3K B/AYURk7/tCKJjw7wR5010b/zHT78zaf215yKojbrVvQ8pKASuMvNlMVPp7WcbjmltQ//cgrpQY5rzqeKyD8yfUv8tSDG6sMmISqoQbsz1BnQsNKW/fpSUgsmDTNHKmrdIY9ThzbADFe7H9/zlltBDGogiquySlORBWe0nb6m6BdHzy96/EC7+aExC+H47kW1BttLvJQxgtbBS5+2XFb5Tht24rmwIAg51c2SS1FHlmp5vgto0bb+UGuozcYHlONVD0/8N6iosIUeQCRZIdGQWbI3wd0tD4d8XfTS 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++)