Article View: linux.kernel.netdev
Article #23234Re: [PATCH bpf-next v3 2/4] bpf: Align lpm_trie map values to 8 bytes
From: bot+bpf-ci
Date: Thu, 26 Nov 2026 20:33
Date: Thu, 26 Nov 2026 20:33
52 lines
10610 bytes
10610 bytes
--===============0196374796151550525== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > bpf: Align lpm_trie map values to 8 bytes TL;DR: Commit message only: the claim that lpm_trie nodes don't grow looks wrong for data sizes with remainder 5-7 mod 8, where nodes get 1-3 bytes bigger, possibly moving to a larger kmalloc bucket. Code looks correct. > Place the value at the next 8-byte boundary after the key bytes. So > that nodes don't grow, shrink prefixlen and flags to u16: prefixlen is > at most 2048 and flags has one bit. data[] moves to offset 20 (64-bit) > or 12 (32-bit). Bytes that bpf_mem_alloc asks from kmalloc on 64-bit: > data_size value_size before after > --------- ---------- ------ ----- > 4 28 64 60 > 4 60 96 92 > 16 16 64 64 > 20 12 64 60 Is the statement "So that nodes don't grow" accurate for all key sizes? The bytes in front of the value change from sizeof(struct lpm_trie_node) + data_size (24 + ds on 64-bit, 16 + ds on 32-bit) to round_up(offsetof(struct lpm_trie_node, data) + data_size, 8), which is round_up(20 + ds, 8) or round_up(12 + ds, 8). The difference is (padding - 4), with padding between 0 and 7. When data_size % 8 is 5, 6 or 7, the node becomes 3, 2 or 1 bytes bigger on both 64-bit and 32-bit. For example, with data_size 6 (an IPv4 address plus a port), 24 + 6 = 30 becomes round_up(26, 8) = 32. The growth can also move a node into a larger kmalloc bucket. On 64-bit with data_size 5 and value_size 27, the request is 24 + 5 + 27 + 8 = 64 before and 32 + 27 + 8 = 67 after, so the node moves from kmalloc-64 to kmalloc-96. The table only lists data_size 4, 16 and 20, where nodes shrink or stay the same. The code looks correct, so this is about the rationale. Could the wording say that the u16 shrink keeps the alignment padding to at most 3 bytes and makes IPv4 nodes 4 bytes smaller? --- AI reviewed your patch. Please fix the bug or email reply why it's not a bug. See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md CI run summary: https://github.com/kernel-patches/bpf/actions/runs/45888065586 --===============0196374796151550525==--
Technical Details
Message-ID:
<b2b87080b87c640725acc68ec507cf39cc2ed37d2524036c52326923c8d1eb0b@mail.kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!npeer.as286.net!npeer-ng0.as286.net!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372325-linux-kernel-netdev=dewy.ruReferences:
<20261126194347.42466-3-tphilipp@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!npeer.as286.net!npeer-ng0.as286.net!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372325-linux-kernel-netdev=dewy.ru From: bot+bpf-ci@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH bpf-next v3 2/4] bpf: Align lpm_trie map values to 8 bytes Date: Thu, 26 Nov 2026 20:33:33 +0000 (UTC) Organization: Usenet Network Message-ID: <b2b87080b87c640725acc68ec507cf39cc2ed37d2524036c52326923c8d1eb0b@mail.kernel.org> References: <20261126194347.42466-3-tphilipp@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0196374796151550525==" Injection-Info: usenet.network; logging-data="557581"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:dZlmp6pzBhS3ckyOeGX+ZZs14F0= sha256:1zHXJssH719nqHus83tYzCty7yJfGrzjSTRDXljMbuI= sha1:lqk5HBI+/VWJli6IjWa7DgRzNh4= sha256:c/11I7FS8guL+lQpbTAhn3qCx+OfPsRFgwu+wRv/WHk= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 70B8A125EFF; Thu, 26 Nov 2026 23:34:00 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nE9y7PHMCXLf; Thu, 26 Nov 2026 23:33:57 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372325-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 99144125EFD; Thu, 26 Nov 2026 23:33:48 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 901992FF26; Thu, 26 Nov 2026 20:33:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795725217; b=LAyMPM5rEWwsVNqFnil2WRBkEsuZTt6kSwSmsT8CEnWW/uGLLTwXjfCgOnYvn/vQy5X3 SnRVo0Nyxp2+wzcfKt3UnE03xcUvbpi/69OrQP9qiAwryMP0YzNHXkepfPBUZp/voFXoU ZRTBGCoxjaRZaFFD0/aEyh0qC1HK6LbVHvY+d848jaXpjgzsANij73/eX5SiKjB4v6A3a GonauFpimVre7XSP08H+AVVPJC/u1tAZfO4wAxnncTfltGG4COvu+T15Ki1NVjunCzvNt qGPU2sS3knHyYkeIv2my9SlKTZ5X+zqAAwZf/1QO2d75fpZebW2+m1BjGn2xcA4fS/w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795725217; h=X-Original-To:Received:Received:DKIM-Signature:Content-Type: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=j0lOazSlpqZPrAY6B6EZh8T8S4V13+7bnpdjejE/rFU=; b=Etpx+5R0yRVg0tmc0yTrLgYV4Io9Y+WTxGnMcXSVKXINPTe7ElgAYXJU2PJ0uaXfoocn graKj01/Ir1hnD1cWmdc0/JIhQsOU45kJOQPnH4gBS6skhCJROiun8MNbk6WXeFOa+j/f VoBU20U6yIsNCgbMSIpU9B06blH4tuJ+G8JI53aTO246oQFJ+QbIKuqYzi3L8WQ7zMikE HlkPOw0H+R4lilzW8Tzni2uk6Q90263bzVOvk7+/DPn/RRNiTZ8o0QOvjIpfJsXEHxBY1 OXJHO9cPn6ptC+fwJpEa/93UiVzb7dbB/z2kvpbboXhgpP98Ir8qlwcV/4z+3eveETw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Z/AG4Jqv"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6856E606A327; Thu, 26 Nov 2026 20:33:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z/AG4Jqv X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795725216; b=Dqv768T8W5QqNZ7yWcnJH2OmUcNnf4qbZZUxa7mb6MCQhetv6DtzTo9+9UEUQ9aHnOoH galuvQxfYEDIit4IeeLc41UZ+5/qDpTKqWnBMaXYEwiMpk7LLdurtvZsW5ViNysNbKvx1 7GqH/1s0mW7u83IiRwOPJUgp+6k33Vq1/qwsfw5SNFY7z703WDhGAqOq/b9hb1LTRCWAP ZiZA0vJV4ZP6Se6kdS37G9mj4oxwKmeCf60YPj9ZC2CIL3UDjyngxJrkGST+ewY/ps20q stwQAO/Uut2I2vQ1crXEFLBG6uOeJvq7MJXcdPS68MK2QJwIrzgDIPB9ftTogZbKovQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795725216; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=j0lOazSlpqZPrAY6B6EZh8T8S4V13+7bnpdjejE/rFU=; b=CyNJGgKsfLPUI2AQiH0k/tPZTMfmckcncc1Xo0Mz0O7sZN2e5zo5hWOz9+6YuU1iQjZx L/ZHXbC6kdhcOChwZfM3XD52dx+wzzrxMj+B0lKSfl2/qLcBB71QTDZVipDnfwgIL2yf1 cDBT0UxmvBD5sgo30imXBNBCKuaJ7gDKoFf2tYLXh+SfvnqbYzVrzDatwpaN1MoVOlCiD wzIeDbQ7IY8oHdb+gYNOrIAbSXnljZh3/gdFlJ4g4pKr2elL1P7Mk5Y+UKhzswzRN76r4 m6dfXTQdiQtGfYDMQTPiMlCX7fbI8kp69E4BYeT0q57lwmVAPfXCWdlWfpEvsEiqdqQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Z/AG4Jqv"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8655B606A31E; Thu, 26 Nov 2026 20:33:36 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 300F21F00923; Thu, 26 Nov 2026 20:33:33 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795725216; bh=j0lOazSlpqZPrAY6B6EZh8T8S4V13+7bnpdjejE/rFU=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=Z/AG4JqvEW2GjgD3GVwYfKM4atObtDtAPdofFEwV1awXHaqrpIiZbWlrmfU9lHKCl AI3/BnmQkTBvmj2qbSeATlJ1dyRsDqA0msGnDO6SzzsaeEkeYGygZ1T79I7gBIG8EK VY1Ypz7R9yq9pqDCzNJtcAJtpWitK6sxmqTZSiVthcdeEiqXCrh6xe0zSKv4POQt+e 7A9y20cWBvSYwH7fmx/b82zlo//jmubnJ/RXNimCaIjHa9YJ3c3idEfru53fEOxuVi lOhfVc+ZvsY5GGkzUCo2uDylbsuFsaAk5TkQMDSfGOB89TRgm88G26UcWu/MG2cKaC 7MReOUDYgbckw== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261126194347.42466-3-tphilipp@gmail.com> X-Cc: tphilipp@gmail.com,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,martin.lau@linux.dev,eddyz87@gmail.com,memxor@gmail.com,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,john.fastabend@gmail.com,sdf@fomichev.me,emil@etsalapatis.com,ihor.solodrai@linux.dev,hawk@kernel.org,davem@davemloft.net,kuba@kernel.org,shuah@kernel.org,nbd@nbd.name,hacks@slashdirt.org,stijn@linux-ipv6.be,daniel@zonque.org,netdev@vger.kernel.org,linux-kselftest@vger.kernel.org,linux-kernel@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev X-Received-Bytes: 10338