From: Florian Westphal <fw@strlen.de>
To: Scott Mitchell <scott.k.mitch1@gmail.com>
Cc: pablo@netfilter.org, kadlec@netfilter.org, phil@nwl.cc,
davem@davemloft.net, edumazet@google.com, 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
Subject: Re: [PATCH v3] netfilter: nfnetlink_queue: optimize verdict lookup with hash table
Date: Thu, 13 Nov 2025 16:55:00 +0100 [thread overview]
Message-ID: <aRX_VP61EqRM-8z7@strlen.de> (raw)
In-Reply-To: <20251113153220.16961-1-scott_mitchell@apple.com>
Scott Mitchell <scott.k.mitch1@gmail.com> wrote:
> +static int
> +nfqnl_hash_resize(struct nfqnl_instance *inst, u32 hash_size)
> +{
> + struct hlist_head *new_hash, *old_hash;
> + struct nf_queue_entry *entry;
> + unsigned int h, hash_mask;
> +
> + hash_size = nfqnl_normalize_hash_size(hash_size);
> + if (hash_size == inst->queue_hash_size)
> + return 0;
> +
> + new_hash = kvcalloc(hash_size, sizeof(*new_hash), GFP_KERNEL_ACCOUNT);
This doesn't work, please re-test with LOCKDEP enabled before sending
next version.
> + inst->queue_hash = kvcalloc(hash_size, sizeof(*inst->queue_hash),
> + GFP_KERNEL_ACCOUNT);
.. and this doesn't work either, we are holding rcu read lock and
the queue instance spinlock, so we cannot do a sleeping allocation.
That said, I don't see a compelling reason why rcu read lock is held
here, but resolving that needs prep work :-/
So there are only two choices:
1. add a prep patch that pushes the locks to where they are needed,
the rebase this patch on top
2. use GFP_ATOMIC like in v1 and update comment to say that
GFP_KERNEL_ACCOUNT would need more work to place allocations
outside of the locks.
next prev parent reply other threads:[~2025-11-13 15:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 15:32 [PATCH v3] netfilter: nfnetlink_queue: optimize verdict lookup with hash table Scott Mitchell
2025-11-13 15:55 ` Florian Westphal [this message]
2025-11-13 16:15 ` Scott Mitchell
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=aRX_VP61EqRM-8z7@strlen.de \
--to=fw@strlen.de \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--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 \
/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).