From patchwork Thu Apr 11 16:05:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13626228 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 444F1C4345F for ; Thu, 11 Apr 2024 16:06:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C76876B00B2; Thu, 11 Apr 2024 12:06:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C015B6B00B8; Thu, 11 Apr 2024 12:06:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A79A26B00B9; Thu, 11 Apr 2024 12:06:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 836036B00B2 for ; Thu, 11 Apr 2024 12:06:12 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B19DF1C0FB2 for ; Thu, 11 Apr 2024 16:06:06 +0000 (UTC) X-FDA: 81997727532.13.64CDF74 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf27.hostedemail.com (Postfix) with ESMTP id 8EEE64000A for ; Thu, 11 Apr 2024 16:06:04 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ovFpkGfx; spf=pass (imf27.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712851565; a=rsa-sha256; cv=none; b=W4pKcSUsNlvfHexSAGAqBVZhbiGJTMteXh9jHk84qUIy45r7yc/yfe5Lbe68nzLdQZXOpy 6OQGRsSFDG5LXSHor46EyvadIlPrfpj8yzdQJEEEMIOt+PgDMDA1j4SCTB3xoVpLz4Or+m qX9yxgxefFUT1r/L/pD7yL3Mq5tGuXU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ovFpkGfx; spf=pass (imf27.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 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=1712851565; 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=ahMY2UZCCmOY2lnt6y1hTYQ48CfCwc3PtNZ1yPGnAbU=; b=Peet5XBQLMAdpj09W1QcArMNA1Ty8eM/73xjUV8HfD/SbArz3yPXgI0oB749se2Nr/yGwE 7rCAH7MIbH1Dp0FTDU3bBACAnbQ8hmPpaPioZn4MLgovEWnT7j468WhwTK3ee4BR9ratUr 4FSrH+f9jdqwN/lOCEu0M3ukADaUYkA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 19927CE17B0; Thu, 11 Apr 2024 16:06:02 +0000 (UTC) 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> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 8EEE64000A X-Stat-Signature: 691nfza81syqfertayf4txmhhkig79tc X-Rspam-User: X-HE-Tag: 1712851564-4737 X-HE-Meta: U2FsdGVkX18A3+eGj9Al2QymUn1qAv+++qjpuGfsyQAtbu43ikWsrTAZJwFaRlU2pUik3Su5Vw1d3U0RjMMT3iPTe2z0G4MBguGLa3wCBQpCw1AgcBeZGcX2N6e7br7ZDucyl14AsbJPgz0W/5np9oCp8m26wx6scfjAsP25pEz+LRSfSh6aSRMWjSJkVQDXhE2M7Bt+gMDjhBVOrezwYG0cHGWfpPaaCKrHPHguZZ46j6Ptwb8jP3sVdDjDqPshuaW4QVl+TCh4zsO+Se1t/QOoektiJrGXrPTt02Wtk56ArUwUquVSmnoZfTv9E2SOZkLC5poQG7GCXDNouop+p3LpHF3pVVH/1tLGefOoa8lkpx7J55mmMxuCQVo0q/SL8OBUv1V85hkF2z/LKNTGa9FjgAPFnMvy0MFAAA4A8ohVwFG2/9roROoZccNdZutES0XyA8zv3rysLs+zsJRQtDHok3Szdko4mz/zmPL18q8kfzlkjh10RlSFzaCy2DndqnZ07jgBTvN9f6PNNhFZs4JpWACBJV0uYqAyHn3tSbrJk+tEGFgPqHXZjRxk8ZY+TkV2IB0pAOrMuQYQLa244a7Ldh6GsBpB/gr1JalRb9i5yOHy/5kgmWHZKSbqsbWz6rOpK59rb3zXvFGpZXT86CExonYZ5EspUVo4MX0/cZ/l39msHIqV3gzoenT58eeztTXv9Q+XK2LtGjSrpvAfupLJzvxZaSQr1WOdkkO6KL0e5z8UY7Fy0WfsTKVPkTz39mPOPVqffsi5e8xWz1CFZMvbeV87q+kkD3br++Q+4H13wMvz34gsiXN3Su5mIr3r+uGj77lR76o7pg2ydn+5GCBkplM9q8xzdJKMSVGFTBUfrntFQhl86g5UD48N8KmwuFM58inNEuellRP2FUmp5vi50smVF+t/cZjfynu8HZ6h3fn7IfO37i+djSak01r1tLzzY5Y6FQzYogdxsoU 5PS8vA/U azuHT 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 (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);