From: David Laight <david.laight.linux@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Scott Mitchell <scott.k.mitch1@gmail.com>,
pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de,
phil@nwl.cc, davem@davemloft.net, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Scott Mitchell <scott_mitchell@apple.com>
Subject: Re: [PATCH v2] netfilter: nfnetlink_queue: optimize verdict lookup with hash table
Date: Thu, 13 Nov 2025 19:40:29 +0000 [thread overview]
Message-ID: <20251113194029.5d4cf9d7@pumpkin> (raw)
In-Reply-To: <CANn89iJAH0-6FiK-wnA=WUS8ddyQ-q2e7vfK=7-Yrqgi_HrXAQ@mail.gmail.com>
On Thu, 13 Nov 2025 02:25:24 -0800
Eric Dumazet <edumazet@google.com> wrote:
> On Thu, Nov 13, 2025 at 1:26 AM Scott Mitchell <scott.k.mitch1@gmail.com> wrote:
....
> I do not think this is an efficient hash function.
>
> queue->id_sequence is monotonically increasing (controlled by the
> kernel : __nfqnl_enqueue_packet(), not user space).
If id_sequence is allocated by the kernel, is there any requirement
that the values be sequential rather than just unique?
If they don't need to be sequential then the kernel can pick an 'id' value
such that 'id & mask' is unique for all 'live' id values.
Then the hash becomes 'perfect' and degenerates into a simple array lookup.
Just needs a bit of housekeeping...
David
next prev parent reply other threads:[~2025-11-13 19:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 9:26 [PATCH v2] netfilter: nfnetlink_queue: optimize verdict lookup with hash table Scott Mitchell
2025-11-13 10:25 ` Eric Dumazet
2025-11-13 15:30 ` Scott Mitchell
2025-11-13 19:40 ` David Laight [this message]
2025-11-13 20:56 ` Scott Mitchell
2025-11-13 12:19 ` Florian Westphal
2025-11-13 15:32 ` Scott Mitchell
2025-11-13 13:50 ` [syzbot ci] " syzbot ci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251113194029.5d4cf9d7@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=scott.k.mitch1@gmail.com \
--cc=scott_mitchell@apple.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).