]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: conntrack: revisit gc autotuning
authorFlorian Westphal <fw@strlen.de>
Wed, 16 Feb 2022 15:43:05 +0000 (16:43 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 19 Mar 2022 22:11:34 +0000 (23:11 +0100)
commit5c8e48b81da49b5642bc30bac6a19aa8ca335708
tree21f18191856ed0f81f7d4b4b0a0c790cf9fe92ae
parentc278c4b64118cda71ed9b4f8b74d6f02aa5b0230
netfilter: conntrack: revisit gc autotuning

as of commit c62db4711448
("netfilter: conntrack: collect all entries in one cycle")
conntrack gc was changed to run every 2 minutes.

On systems where conntrack hash table is set to large value, most evictions
happen from gc worker rather than the packet path due to hash table
distribution.

This causes netlink event overflows when events are collected.

This change collects average expiry of scanned entries and
reschedules to the average remaining value, within 1 to 60 second interval.

To avoid event overflows, reschedule after each bucket and add a
limit for both run time and number of evictions per run.

If more entries have to be evicted, reschedule and restart 1 jiffy
into the future.

Reported-by: Karel Rericha <karel@maxtel.cz>
Cc: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Cc: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_core.c