Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp90424lqj; Thu, 11 Apr 2024 10:36:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXURp+QwAHwYuZ42E05EH9gC6TJqB40oTxbiDcnRMCSMcDjB7FVz1g946lDY7CoZhvxMLyu4IONnIRfeUlaF1abeM6XPW4wEQk7mydkog== X-Google-Smtp-Source: AGHT+IEZTWfxB8AWaxTDl7WlaTJhQMZd9UAIjhtqmog3HIAf7TtNF6Wkrjtj1jK4cUjszILNKlnH X-Received: by 2002:a05:6a21:32a3:b0:1a7:aa1a:26d7 with SMTP id yt35-20020a056a2132a300b001a7aa1a26d7mr576532pzb.3.1712857006132; Thu, 11 Apr 2024 10:36:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712857006; cv=pass; d=google.com; s=arc-20160816; b=I1lXWv3to+SCUvBKysBbWb9L7d4hLLCJGXbUrfjr4qEGPNThq87gtYrSoAFeIdnafT 1gaHvUHYHjGLU7I8+lE07aSmJhsMg3he2AZbPQsGiEvl0nOYCnMhkd5oAe7bG4E1KojR 6Xe07krIKJklDR9I/mCOTRmsdQ+klwppMi1+InD2OYkUzReXREEJei02KSDPCKnXkOHC IvKffcUQcqwZ7c/veXw+FTebW3wIfRF9gUlMJVQVfNp3anfo1A6ZsB/f9eFU70/jZok1 jUOQoGglCctYfy6D3/GtXue0dW+0Tdt5evrK+QlGz0GxV/a/DsZnjw5Yn/HDa/VpeNcf N6Kg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ahMY2UZCCmOY2lnt6y1hTYQ48CfCwc3PtNZ1yPGnAbU=; fh=gMFRjFG9KasUYvwr0WK5/KYxde7tueU8fZSQFYWo6W4=; b=CBWGHOsRRft0t2i0s1b9+vInWr5SiCzO2BPPqbEgBK+CodjN1DDUx0t8Qvbr9wYmW0 77X7bLB4qBpGoEhYbEHYw+OjVcC7klmyCm8JvGfUvNSBqCtt8TYUIdWjDiPOKjUl3koK DpPLozsdodqkyegSLkaxC/E47A197X1dm+HnKvmVCsfI1VldTs/5/iiZWXvs21PrYmUM 8ZFIwyv/lCyNxffmVd7vhHHvzMS+nbKudp0UwodiVPpdET0tfBAgZtPdBWN2FCyZ7nDD oWTRlNF51Ie5GXdio6jHOwGKnDr8Yieanwuiekd2mZ8JpATIYo7ogVmqNvTDyQskKP6Y dzNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ovFpkGfx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-141272-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id a20-20020a056a000c9400b006edc97fdb8dsi1752076pfv.70.2024.04.11.10.36.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 10:36:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141272-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ovFpkGfx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-141272-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 25DD4283DBC for ; Thu, 11 Apr 2024 17:36:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 806F413AA2B; Thu, 11 Apr 2024 16:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ovFpkGfx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A1A313A87E; Thu, 11 Apr 2024 16:06:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712851561; cv=none; b=kOsX2bvZOKTVgTUsp0XNSZQfko5X1BsEdN8y6GhnXujxbkKyPhmCfvWxg8P+X9wX+FPoPn+pkbI5bc3ltS1nEuoNN0OWnEbAGZXuYZicoPHMIYtrmtkzJQ0/aytOm53whRPUUscnEO3BT/YtM2tugC4kLoDvIpCHc6MS+nM0Dh0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712851561; c=relaxed/simple; bh=iSP5sYQTC9lwrdkyTRCMZ/AI3wIT9Uf2038HZsTjvAE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZTZqUl1e3tpe4rZdVfX6kwTQpYOg7090X128yYX4V9nbRtx6aXps1y0MdCKnIx6QByB1cXCQRh7StM/Oi0oXUqLB+F/1iVlZUu7DafHw6aQMkh2YqoXz4TStgbVTWhS0YNNODmyECJFzeEqkw3qYvErmEVqTTe4SgWINE+om63E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ovFpkGfx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 949B2C072AA; Thu, 11 Apr 2024 16:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712851561; bh=iSP5sYQTC9lwrdkyTRCMZ/AI3wIT9Uf2038HZsTjvAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ovFpkGfxLq3VLtK3zTiOpRiMUuHSj2aiPSN6C/2SRNq664nlaPNpFsB86F1602l7u 7x9tXroJeTOj2P3kWXEbf0cNKeCKXlL5Z4Sc5pYnmQqjo7nYylppKAmPrsG84c3xFC 9NLRnLJz/65Ix26qDiSIpHtq5GstadUuAmNfpX4ftuviQzf7kPayNTFCmqVcxekiXu tOnqW1WH/Bp8QN30gHTwPwqzQE4VIoI2pDvfSao52LnJ/WtUsvjtbqmKqzdjt5jtR4 PNYlFSwbj57Sxuy4SqIdHL9SF2Awen6ZrBqp2ySRFhA1gGw1GOyPWd71dNY53aHmAL ytLAFgcoDjD+A== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Andy Lutomirski , Arnd Bergmann , Catalin Marinas , Christoph Hellwig , Helge Deller , Lorenzo Stoakes , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Mathieu Desnoyers , Michael Ellerman , Mike Rapoport , Palmer Dabbelt , Peter Zijlstra , Russell King , Song Liu , Steven Rostedt , Thomas Gleixner , Uladzislau Rezki , Will Deacon , bpf@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: [RFC PATCH 2/7] mm: vmalloc: don't account for number of nodes for HUGE_VMAP allocations Date: Thu, 11 Apr 2024 19:05:21 +0300 Message-ID: <20240411160526.2093408-3-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411160526.2093408-1-rppt@kernel.org> References: <20240411160526.2093408-1-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Mike Rapoport (IBM)" vmalloc allocations with VM_ALLOW_HUGE_VMAP that do not explictly specify node ID will use huge pages only if size_per_node is larger than PMD_SIZE. Still the actual allocated memory is not distributed between nodes and there is no advantage in such approach. On the contrary, BPF allocates PMD_SIZE * num_possible_nodes() for each new bpf_prog_pack, while it could do with PMD_SIZE'ed packs. Don't account for number of nodes for VM_ALLOW_HUGE_VMAP with NUMA_NO_NODE and use huge pages whenever the requested allocation size is larger than PMD_SIZE. Signed-off-by: Mike Rapoport (IBM) --- mm/vmalloc.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 22aa63f4ef63..5fc8b514e457 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3737,8 +3737,6 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, } if (vmap_allow_huge && (vm_flags & VM_ALLOW_HUGE_VMAP)) { - unsigned long size_per_node; - /* * Try huge pages. Only try for PAGE_KERNEL allocations, * others like modules don't yet expect huge pages in @@ -3746,13 +3744,10 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, * supporting them. */ - size_per_node = size; - if (node == NUMA_NO_NODE) - size_per_node /= num_online_nodes(); - if (arch_vmap_pmd_supported(prot) && size_per_node >= PMD_SIZE) + if (arch_vmap_pmd_supported(prot) && size >= PMD_SIZE) shift = PMD_SHIFT; else - shift = arch_vmap_pte_supported_shift(size_per_node); + shift = arch_vmap_pte_supported_shift(size); align = max(real_align, 1UL << shift); size = ALIGN(real_size, 1UL << shift); -- 2.43.0