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: 13734433 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BF9DC3DA49 for ; Tue, 16 Jul 2024 11:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n3zGa4nacsbBJXSOfEQISOWNqxdB+lCQQh30s7NcvRc=; b=CecWNapOG3Ha/RnFlBpx2P4XLx uOUhjLv/Abo//3WTzvfy3BBCcxAtagLCAi9wC0f5i25zG1+Cn18gcQrB2JoPTz9ntcvpiew3CfHuC /zhgwk3lIFbHXbkeHmgzRJvpSjZv8dNbS71FZxxCsvJMkz4z02Ng9OILVXkQw1D5scv4HLELhh9BQ 7gMII9m4RczLBUudHNwJLDahWOzQ6R5DeIZ5n+cA51vA5PXTZxkgdbh2llwMv1W4Srha4t9UJBRt3 9m9gi27zMtTxgp+/Pq4qAW8tSLH7N5ztE16dAyXGaCX6YthQ8qNRe8f/ClBa2nFfBpWLeq22yD2wQ w2U7rp2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTgBm-0000000ABu2-31Zq; Tue, 16 Jul 2024 11:17:46 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTg9Y-0000000AAMc-1sVj; Tue, 16 Jul 2024 11:15:30 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_041528_683089_CFA4B5AD X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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++)