From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5259BC4345F for ; Sun, 14 Apr 2024 07:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dmz2ksL/oCb9aTEIxeXKU3oievMjDuApEqBAiClt6hw=; b=GWHP0c7PVoJxdo R6RSyz8Rb0z03KaYp7o67Bh9GCY/5oGJGL9Ra6J970MI1avQ5Bw8htsE02k++X9JfrzNl7K3JkakV kzn7WJvwIQStfHnBn/HgHQ3qVqX3qM0BvNzN0fNn8shBIBumscfrxAqFdA62n0VhYmKoj/eDFVkzd FjRPu07q39baaZRlJboXu4sJbLfKqCpv/XjV5+gTGDlaImFD04F+fJ/D/Ancn3lW5F7O/tp17qh/u 4HHh0cTEnolxbtrlhySCdo3nt+JRnRMbCxEYGhmoXrHEh1ajjrrKNOP2HRbme7MZBmg+QGeR7SPJu 1fF0k4mzIrLaEsMNMvHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvuOY-00000004uF9-3T4W; Sun, 14 Apr 2024 07:35:22 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvuOU-00000004uB6-33g0; Sun, 14 Apr 2024 07:35:21 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7DD3FCE0660; Sun, 14 Apr 2024 07:35:14 +0000 (UTC) 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9217c95a-39f6-49ce-9857-ee2eebdb7a16@csgroup.eu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240414_003519_821774_C65AAABD X-CRM114-Status: GOOD ( 22.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Apr 12, 2024 at 06:07:19AM +0000, Christophe Leroy wrote: > = > = > Le 11/04/2024 =E0 18:05, Mike Rapoport a =E9crit=A0: > > 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, un= signed 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 =3D size; > > - if (node =3D=3D NUMA_NO_NODE) > > - size_per_node /=3D num_online_nodes(); > > - if (arch_vmap_pmd_supported(prot) && size_per_node >=3D PMD_SIZE) > > + if (arch_vmap_pmd_supported(prot) && size >=3D PMD_SIZE) > > shift =3D PMD_SHIFT; > > else > > - shift =3D arch_vmap_pte_supported_shift(size_per_node); > > + shift =3D arch_vmap_pte_supported_shift(size); > > = > > align =3D max(real_align, 1UL << shift); > > size =3D ALIGN(real_size, 1UL << shift); -- = Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel