Skip to content

netfilter: nf_tables: avoid atomic allocations for set flush

Florian Westphal netfilter-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 3 repliesIn review
  2. v12 patches 15 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2netfilter: nf_tables: allow iter callbacks to sleepinclude/net/netfilter/nf_tables.h net/netfilter/nft_set_hash.c net/netfilter/nft_set_rbtree.c+128 -113 replies
2/2netfilter: nf_tables: all transaction allocations can now sleepnet/netfilter/nf_tables_api.c+19 -280 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH nf-next v2 0/2] netfilter: nf_tables: avoid atomic allocations for set flush

Sven Auhagen reports memory allocation errors during set flush. This is because of GFP_ATOMIC allocations because rhashtable walker uses rcu and cannot sleep.

Build a linear list in rhashtable walker, drop rcu read lock and then call the iter callback in a second loop.

This allows use of GFP_KERNEL allocations.

The second loop has no noticeable impact on set flush durations, even for large (800k entries) sets.

Florian Westphal (2):
netfilter: nf_tables: allow iter callbacks to sleep
netfilter: nf_tables: all transaction allocations can now sleep

 include/net/netfilter/nf_tables.h |   2 +
 net/netfilter/nf_tables_api.c     |  47 ++++++--------
 net/netfilter/nft_set_hash.c      | 102 +++++++++++++++++++++++++++++-
 net/netfilter/nft_set_rbtree.c    |  35 +++++++---
 4 files changed, 147 insertions(+), 39 deletions(-)
Signature · 1 line
2.49.1