Skip to content

RFC nf_tables: speed up rule addition and deletion

[email protected] netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2netfilter: nf_tables: use 64-bits rule handle instead of 16-bitsinclude/net/netfilter/nf_tables.h net/netfilter/nf_tables_api.c+10 -170 replies
2/2netfilter: nf_tables: improve deletion performanceinclude/net/netfilter/nf_tables.h net/netfilter/nf_tables_api.c+3 -103 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] [RFC] nf_tables: speed up rule addition and deletion

From: Pablo Neira Ayuso <[email protected]>

Hi!

The following two RFC patches aim to improve rule addition and deletion timing.

The current major bottleneck in the rule addition is the handle allocation per chain which is O(n), a simple way to get it O(1) is to use a 64-bits handle instead of 16-bits to uniquely identify the rule.

The main concern here is to avoid wrap around of the handle (so we have no two rules with the same handle). We could stick to 32-bits. Overrun would happen after 2^32 rule additions, that seems unlikely but still possible in scenario in which rules are dynamically added and deleted.

Regarding deletion, as it was documented in the source code, synchronize_rcu() really make performance suck. The alternative is to use kfree_rcu() and add one struct rcu_head per rule. This increases the length of the rule structure.

I didn't come with any better simple solution like these two.

I think this is yet another space-time tradeoff thing. So I'd put pressure on the memory side at this moment.

Comments welcome.

Signature · 1 line
1.7.10.4