From patchwork Thu Aug 1 06:08:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13749642 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 0C2CFC3DA4A for ; Thu, 1 Aug 2024 06:11:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8FA206B00AA; Thu, 1 Aug 2024 02:11:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8598B6B00AC; Thu, 1 Aug 2024 02:11:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 637E76B00AD; Thu, 1 Aug 2024 02:11:22 -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 393786B00AA for ; Thu, 1 Aug 2024 02:11:22 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E9100A08CD for ; Thu, 1 Aug 2024 06:11:21 +0000 (UTC) X-FDA: 82402654362.09.3B4AC26 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 468D8180018 for ; Thu, 1 Aug 2024 06:11:20 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QI4Ewjqh; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.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=1722492634; a=rsa-sha256; cv=none; b=lCoWnbGzKS+1NFsUVG8Ze9jQqmjCVlWbnwBkx568X+MPFtqEb83myAsgX9X1/eB+5ntwSp inmUIQ833D1XKO8/SI0N3mIgnoLcBBIF1iWlrobYZ7K+O4T7fi+dyzRfIJqas6oVSwcnzq Gfc1Q4E1wATbePetOTs0gR00cPlvsDA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QI4Ewjqh; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.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=1722492634; 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=nmzOpg0JTx1pCcKSTmmbgph0fZ/wgtHghU2Q/iaXZP4=; b=D+QVwt1fcHc5wk4BzkGL0Mcm5uKSwyPVfes+Ty66DSddR1mY9UUzy846Hvu7Jv3VNvaYNg 30Q5Wtk8YPeP08Qwu6NcMxGOnE1WN0tfqzMsKU7BRJnKL8eTRbuUXkkljAFH8nq/DRHgfU gMyvpawBOcc+puRhoKd1EjgFbXE9MA0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 620B162770; Thu, 1 Aug 2024 06:11:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE12DC4AF0A; Thu, 1 Aug 2024 06:11:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722492679; bh=UKbRiZvva5pXaCAN24L+st+TlDsrE6ScVNjHbfzaMRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QI4EwjqhxFK7jXHI8z7S0O57azEU4hGOVevIE/YotTQq1td3MZ2supNz+Ar1UY/8p CqH0vm+HUdWwyyQtOmTJL8GxeHWgkoxA9rHrAqFDpO8QZvDQ0B7A/qtQd6XIYMmvCL yF+WVGjYTgkr8pTlPUXdfLQPO4+BiiuOVGnFri2SIJQj7s3JUdSLac9RwDt0im45/z KF+xkSA/StepsYoUsUx9dms3l08hn82DVtcw4Ebjuu7NI0IYntmyRLFRWCUSLJV2AM w6aVlRwary2DoahCBShwjZmokC0xXVajZA+CqgVwGuwUANLNZrZgdNx4T+e3NLqx7w MkJo6xLcQkn0w== 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 v3 13/26] x86/numa_emu: simplify allocation of phys_dist Date: Thu, 1 Aug 2024 09:08:13 +0300 Message-ID: <20240801060826.559858-14-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240801060826.559858-1-rppt@kernel.org> References: <20240801060826.559858-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 468D8180018 X-Stat-Signature: 61wocwg33jispo1sux9nyei36uf94qts X-Rspam-User: X-HE-Tag: 1722492680-41885 X-HE-Meta: U2FsdGVkX1/jBRnlJXAGS8p1FlJjoukWFepYV+b7ORogfdt7FblZjQkWIuRRm4/7r7jjUcBtk8Ne0YV4kW/mvmuoWLLXxEvRHI2QEUtbdGIFRW3XC64v82naSQxpRnq2+Z4SrgiB84TBm1sjS0UIJfmRyjXTbf8gThET/dzs13h+aXVv0p/iLaXy7em5eObG6Lv5vvVv/M0wzBAnnmAlFKvgTQYiupu9V69/mWlON3kJhabClaSSkLGj13pwuVAAbRqLSLhJq1t4jD0fx4OdqKqaOWGc/JQ9FjOk+WJmAFoaiJWLrge+5DeE9oX4/QJEDke9Zx831LN7JXnvoW6t0ZfJr4lJA5ZE9nYWL5qCwD70k/CFI7iRfhiPVbZXzTSOxrPZ811LKy3fv6FB8wlTu9ANLgeC5TtS0uR86Jd7hlSizOKN8QblhtjFsB+fq+cE1PNnz6pBLYgWVvTCDBBGXYjS+FdZZ7OUXCXDdPX8zifroLKPXrVbglSIPy6TSk3UvH7IOI8f9CGQOjfV1r8WJXjA3C8JfJUavz7cN5+Aei7f468kkjwKHhHSoL31vWL8RNvtGPH73xaU/k1UR1TQv8QjfaGD868cWZMiXnt5bvIx5prVWjWrJGtjHH79G0RN00o8/46OZ44TsFqCAFutlQUEsvScfdVL2V3JRn4zC9shv9ggQyvfsKBjwaaBrzT2hPuJM5Tx3BCf2PFDHbnUUK0jFQZE5cP8m+Y4draulekCsbIHljOLLdHU8OOmVhUO9EPY32b5QP1roAh0PuEfAY4FMf+Fqi0J0wiEl2Ohp2h8THWdwib5GHkZ/8z8PwsfWnJtlVrWOQeWuBJ6yV2bcKgy+38UGzf0u+T0fiAxslrrhxigXO2Thnxr82oAzv29bAglHUMwrKJvjTCEqgRbkV9O6ReZCKrQTBVjRLmsCegdffr33/OXwhctgDS++jRI4ytQ4F6wcjA8I2IfLBB DDCW6u+4 +dT3QSzLu5lBUfFpWuUHz9YQnOW3yl/fXwkx3CyIh1zBSeglVusK+GR8khwNanKaQnm0sTTZY9bQS1cecG7Y7Ihr6GtjVyccLuD1R7zIPqs9+p3xFnf9zfn6x0nJffPKkRoUfFNXW88j5ltiD740LyfzuUeGsw31XPvUSna5ophJE/nzoxPK4+Z540l9qDxFpauDWPene9jIyoSEOG5KpwbkR2Xs/X3v8dzOCJOCbamYU1d8OuFZZrNIN4EYOYsJGdOwq5BzmAkwh1NIpu3PP5oggt19/LqKc4nZDrIZvBALI3HZn7CkKgvVjrMf47dm/eMqw1cZCikPtxLM2xZSi/in42tFrrqrvYL5RYwomzlNpiJb4Ail9Bws77A== 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 Tested-by: Zi Yan # for x86_64 and arm64 Acked-by: David Hildenbrand --- 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++)