Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp820001lqp; Sun, 14 Apr 2024 00:35:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5KqwYedlvFxP3C0e042Lpzudxgg0idpPq28AlxZbcUeOdyL5WbJV7g0vwyD7A33tpSxht01BjFwrDqGRzVAFRY6dJjR7UvoZxsrBkgg== X-Google-Smtp-Source: AGHT+IHEmY0y0cV1e+HMNWdi7g9satu/kGf2H/xcByOSi6T6EIb9eCgadflKfUvkuFaXqkTWpEQk X-Received: by 2002:a05:6a20:71d2:b0:1a3:c3e0:518c with SMTP id t18-20020a056a2071d200b001a3c3e0518cmr7228537pzb.52.1713080127594; Sun, 14 Apr 2024 00:35:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713080127; cv=pass; d=google.com; s=arc-20160816; b=KV8D0rmwqxgtdBJdLSjEaoMKSTPp+wZY705tQUv9aEe8qBv9mDd0WRvE7HKeCykiTm 5U+rr/ySoeYquLi6Fso3Hb7y5SY4Sn96WNftxkMxRNRmkwwrU5+qx1fUeP3PFz3nhaG6 IqyXUG6Nv/R9XlRbZIj7XqLQUIx8Yhj5kUE3Z2mQr4PKmh3dhrQ+i9wTlr0q7exXb4vo lUK3Fw6da5zqwJRslYfLmv4eFlwc3WM+yBATTL5g/ylo5EpXj/SDZxnjFOpWwHzVtBax xkE+6Vaaz3fBHz2EKPH/skf4UlaurGtTwh/Gnoy575Gsxe7meiY4D688swKhlCtKv1zB AQaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7bVnsILqFonb9QmaQyRWpUsqw3kdZE1JbY4tH0JteAc=; fh=n6ZoZ49poeL61zrRjynGp4N5T0eXHP4M1rTWfblvM9A=; b=xBYVb3TBLsdrQS9yd8yUi8DJ/hJSvxech76e3ZMsMAjWrepuVylBvERotfiiThx0UM Vl9N0qsB0+dTN/AWqIpIu4HKL9RRUicx1kj6+q6/rmox1qYm8jG4dblb4tupeZzu4EmK TwvSv2UV5dvpFw6lnRuNbNDnX0Gq6pkCKQyRVctyb56oUMDe1B/0r9PfOEKE4VnOOUTw q6paxDyjVYo1oSzzYbLJGv2rceLxOkrdiek53496HEmp6LjqMV4/vgCvkp9VHJMHmVXU PWkF5C+Xj59CIAgUOgSNc8pdgWMIqBk8uvkcs87KrzASxt4GQ4HLZ6FqdmZv/cLyLxP+ Sj8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CkZX4pyV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-144024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144024-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d11-20020a634f0b000000b005f3ffb10873si5973691pgb.503.2024.04.14.00.35.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 00:35:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CkZX4pyV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-144024-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144024-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 43163B20F3F for ; Sun, 14 Apr 2024 07:35:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A03E920DC3; Sun, 14 Apr 2024 07:35:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CkZX4pyV" 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 AD8681EF01; Sun, 14 Apr 2024 07:35:13 +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=1713080113; cv=none; b=jhfvLqamUHK2kY9VNTqF3eDzI2Ftt7Mk7PJCXyk4ATUWzbhfebrsn7U3evEBCasV5X7hMYjOLUgof+yFrHFqx2o5nkJJAud896wkvTNslSlT069J3Xk/NQFMEtk1Bwm+rn/xaYJZicVY8yZ9ES2zMovoNurDDnN9NOe1vpRKumk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713080113; c=relaxed/simple; bh=3r6JYrqvdbon9DEhTY1H2+qNf7eZiRWdkYsZpzrESPk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P9c8pXGPHCQFn/kT++m1l0ssOR9MnSdW6Jo3axbb/KvhYfaw3m195eTQ+lBycNNt8+J8TbGykiRz825GHmhAv3VYw5SVWwFsbr7FyAJVfevmGHVIGRHkLrcJnSgXdowk154oO8h0E1DXUeJ8+gTx/ZqfRhwNA3jArBoxqeMKe08= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CkZX4pyV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E552AC072AA; Sun, 14 Apr 2024 07:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713080113; bh=3r6JYrqvdbon9DEhTY1H2+qNf7eZiRWdkYsZpzrESPk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CkZX4pyVmQMjyHu1MkWMG+OmN+DpitNdvE+8Vnnpv2LwAkTUvDzAFWuF0QZM39J6H Ds3a5kvcM/VK28fYIC44oLB0Bdn+zUbgRasxe5aCWB4xUu/RgLtSeh5qZWnq/2e8FJ rTnb7E26SRg3O/Hr8+YjRqZvnQzlbsBhEdpfwJTzRcQc4vzX1fY1+RLch4UM3gsvOo lhHc3rEpR8JxFCgxftuFbGO+Ys7pTermVZbhFSEMwu4SjmoAKErzDXHDO+V07uYXeL 1NKQmyuzEhmwb/N+lOun0QbkHzR0Hj54fWIETmay8j375CiTaSdfa1+arS37433DN9 Fj6dSalTyF8Tw== Date: Sun, 14 Apr 2024 10:34:00 +0300 From: Mike Rapoport To: Christophe Leroy Cc: "linux-kernel@vger.kernel.org" , Andrew Morton , Andy Lutomirski , Arnd Bergmann , Catalin Marinas , Christoph Hellwig , Helge Deller , Lorenzo Stoakes , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Mathieu Desnoyers , Michael Ellerman , 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: Re: [RFC PATCH 2/7] mm: vmalloc: don't account for number of nodes for HUGE_VMAP allocations Message-ID: References: <20240411160526.2093408-1-rppt@kernel.org> <20240411160526.2093408-3-rppt@kernel.org> <9217c95a-39f6-49ce-9857-ee2eebdb7a16@csgroup.eu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9217c95a-39f6-49ce-9857-ee2eebdb7a16@csgroup.eu> On Fri, Apr 12, 2024 at 06:07:19AM +0000, Christophe Leroy wrote: > > > Le 11/04/2024 ? 18:05, Mike Rapoport a ?crit?: > > 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. > > Patch looks ok but message is confusing. We also use huge pages at PTE > size, for instance 512k pages or 16k pages on powerpc 8xx, while > PMD_SIZE is 4M. Ok, I'll rephrase. > Christophe > > > > > 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); -- Sincerely yours, Mike.