From nobody Thu Apr 25 09:25:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1633027883; cv=none; d=zohomail.com; s=zohoarc; b=hqRihS0wKZWn1V95IMbG7W3lTg1GnWKLpOm9h9Evkce9CeB8S0yK6qZvXNdTIbcxw5/szSot6ukxu1xY4REV8pPZM5rtDn6fseBDgVmiSKAgRZbuKmbgyxtaPnvUOFS+UB9RIql0ZVjFBcNyUWDSVJhlFS7UtGSbr2OUeOQIftE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633027883; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=50WKWg0QVg2XKrZsOyYgqolyS73RGVick6G3Z4q2Xag=; b=bsfQy63tXkP6C/Ny6bDJ/kC/fY8AYgzOruHu/sLYZmHAwKmOox+LjDGvRG1d36ige1m1U0KxsHogyVOBXf/3Ybp6EoHlYnmmNyyq3MiXly9l5WO8ESwDf+ycOirBy+psJR0YAHxigOCmGra3ZWhuLoVDcOcQ/tFGR8gdVdEtBWs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16330278835881020.6159345543799; Thu, 30 Sep 2021 11:51:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.200195.354642 (Exim 4.92) (envelope-from ) id 1mW18t-0007Rp-1z; Thu, 30 Sep 2021 18:50:51 +0000 Received: by outflank-mailman (output) from mailman id 200195.354642; Thu, 30 Sep 2021 18:50:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mW18s-0007Rg-Uk; Thu, 30 Sep 2021 18:50:50 +0000 Received: by outflank-mailman (input) for mailman id 200195; Thu, 30 Sep 2021 18:50:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mW18s-0007RJ-7B for xen-devel@lists.xenproject.org; Thu, 30 Sep 2021 18:50:50 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8a372d29-5879-407e-8d92-235082b553ce; Thu, 30 Sep 2021 18:50:49 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 8637261350; Thu, 30 Sep 2021 18:50:42 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8a372d29-5879-407e-8d92-235082b553ce DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633027849; bh=ISUQEAeabD8TFuzFwCipkjqJm558AV8oII+raBjMcR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/nujFn9CMUdpbr325ijsunQ25k2M/i9/fhbz5LMb3fbAE+MyzkyTivG+OFV7pGA0 0mMCr9cL+6NMUzw1OueI7eDhpkmWrqSBHnTh+7Nay6CoC0XZhtahIjyxjuWdGb1TMY 1fRZO+c8HfzVCLDgD/FPrUdTCnminsC4OmaCiVgNI2Caxtuy3ub58zJW0FfPkLYG/4 R7PbZYxgMJggZ9+WvzrbboZwD/xf9+ZJDL5nQhjHdCwwqiZtN4l9t+qSPzTUbjwwk1 i6P2OXjm/YcqSpDPT9ALm+2hHHTDISEFV6snwAfjb4Ntj5CMY+VJ95ZP8rE0c/vFKI 9qAPHZmD3sE5A== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Christophe Leroy , Juergen Gross , Linus Torvalds , Mike Rapoport , Mike Rapoport , Shahab Vahedi , devicetree@vger.kernel.org, iommu@lists.linux-foundation.org, kasan-dev@googlegroups.com, kvm@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@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, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH v2 1/6] arch_numa: simplify numa_distance allocation Date: Thu, 30 Sep 2021 21:50:26 +0300 Message-Id: <20210930185031.18648-2-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210930185031.18648-1-rppt@kernel.org> References: <20210930185031.18648-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1633027884158100001 Content-Type: text/plain; charset="utf-8" From: Mike Rapoport Memory allocation of numa_distance uses memblock_phys_alloc_range() without actual range limits, converts the returned physical address to virtual and then only uses the virtual address for further initialization. Simplify this by replacing memblock_phys_alloc_range() with memblock_alloc(). Signed-off-by: Mike Rapoport --- drivers/base/arch_numa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index 00fb4120a5b3..f6d0efd01188 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -275,15 +275,13 @@ void __init numa_free_distance(void) static int __init numa_alloc_distance(void) { size_t size; - u64 phys; int i, j; =20 size =3D nr_node_ids * nr_node_ids * sizeof(numa_distance[0]); - phys =3D memblock_phys_alloc_range(size, PAGE_SIZE, 0, PFN_PHYS(max_pfn)); - if (WARN_ON(!phys)) + numa_distance =3D memblock_alloc(size, PAGE_SIZE); + if (WARN_ON(!numa_distance)) return -ENOMEM; =20 - numa_distance =3D __va(phys); numa_distance_cnt =3D nr_node_ids; =20 /* fill with the default distances */ --=20 2.28.0