RFC nf_tables: speed up rule addition and deletion
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest2 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | netfilter: nf_tables: use 64-bits rule handle instead of 16-bitsinclude/ net/ | +10 | 0 replies | |
| 2/2 | netfilter: nf_tables: improve deletion performanceinclude/ net/ | +3 | 3 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
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