From: Phil Sutter <phil@nwl.cc>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next 0/3] netfilter: nft_set_rbtree: use cloned tree for insertions and removal
Date: Wed, 19 Nov 2025 13:52:05 +0100 [thread overview]
Message-ID: <aR29ddgmrjWcayAV@orbyte.nwl.cc> (raw)
In-Reply-To: <9a4e63da-6d36-4365-8c08-547961c9bfa7@suse.de>
Hi,
On Tue, Nov 18, 2025 at 05:07:56PM +0100, Fernando Fernandez Mancera wrote:
> On 11/18/25 12:16 PM, Florian Westphal wrote:
> > This series fixes false negative lookup bug in rbtree set backend that
> > can occur during transaction.
> >
> > First two patches prepare for actual fix, which is coming in last patch.
> >
> > All inserts/removals will now occur in a cloned copy, so packetpath can
> > no longer observe the problematic mixed-bag of old, current and new
> > elements.
> >
> > The live tree will only have reachable elements that are active in the
> > current generation or were active in the previous generation (but are still
> > valid while packetpath holds rcu read lock). The latter case is only
> > temporary, as new lookups already observe the updated tree).
> >
>
> I have been taking a look to the series and testing it with different
> set sizes. The implementation looks good to me but I noticed that due
> the new "clone" mechanism there is an impact on performance when
> modifying an existing rbtree set (inserts or deletions). According to my
> number the impact would be around 40~%. Usually that isn't problematic
> but if big sets are used.. then it is a bit more. e.g
>
> 200K elements ~ avg. time insertion before 510ms after 744ms
> 500K elements ~ avg. time insertion before 5460ms after 7730ms
I wonder if nft_rbtree_maybe_clone() could run a simpler copying
algorithm than properly inserting every element from the old tree into
the new one since the old tree is already correctly organized -
basically leveraging the existing knowledge of every element's correct
position.
Or is there a need to traverse the new tree with each element instead of
copying the whole thing as-is?
Cheers, Phil
next prev parent reply other threads:[~2025-11-19 12:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 11:16 [PATCH nf-next 0/3] netfilter: nft_set_rbtree: use cloned tree for insertions and removal Florian Westphal
2025-11-18 11:16 ` [PATCH nf-next 1/3] netfilter: nft_set_rbtree: prepare for two rbtrees Florian Westphal
2025-11-18 11:16 ` [PATCH nf-next 2/3] netfilter: nft_set_rbtree: factor out insert helper Florian Westphal
2025-11-18 11:16 ` [PATCH nf-next 3/3] netfilter: nft_set_rbtree: do not modifiy live tree Florian Westphal
2025-11-19 8:29 ` kernel test robot
2025-11-19 10:48 ` Florian Westphal
2025-11-18 16:07 ` [PATCH nf-next 0/3] netfilter: nft_set_rbtree: use cloned tree for insertions and removal Fernando Fernandez Mancera
2025-11-18 16:46 ` Florian Westphal
2025-11-18 17:01 ` Fernando Fernandez Mancera
2025-11-19 12:52 ` Phil Sutter [this message]
2025-11-19 15:56 ` Florian Westphal
2025-11-19 22:14 ` Phil Sutter
2025-11-20 10:28 ` Florian Westphal
2025-11-20 11:39 ` Fernando Fernandez Mancera
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=aR29ddgmrjWcayAV@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=fmancera@suse.de \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.