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++)