Skip to content

netfilter: x_tables: speed up iptables-restore

Florian Westphal netfilter-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 1 replyIn review
  2. v32 patches 5 repliesSuperseded
  3. v21 patch 0 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2netfilter: x_tables: make xt_replace_table wait until old rules are not used anymorenet/netfilter/x_tables.c+18 -30 replies
2/2netfilter: x_tables: don't use seqlock when fetching old countersnet/ipv4/netfilter/arp_tables.c net/ipv4/netfilter/ip_tables.c net/ipv6/netfilter/ip6_tables.c+61 -60 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchEric Dumazet
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 nf-next 0/2] netfilter: x_tables: speed up iptables-restore

iptables-restore can take quite a long time when sytem is busy, in order of half a minute or more.

The main reason for this is the way ip(6)tables performs table swap:

When xt_replace_table assigns the new ruleset pointer, it does not wait for other processors to finish with old ruleset.

Instead it relies on the counter sequence lock in get_counters().

This works but this is costly if system is busy as each counter read operation can possibly be restarted indefinitely.

Instead, make xt_replace_table wait until all processors are known to not use the old ruleset anymore.

This allows to read the old counters without any locking, no cpu is using the ruleset anymore so counters can't change either.