]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pf: depessimize table handling
authorMateusz Guzik <mjg@FreeBSD.org>
Fri, 2 Jul 2021 11:19:56 +0000 (13:19 +0200)
committerMateusz Guzik <mjg@FreeBSD.org>
Mon, 5 Jul 2021 08:42:01 +0000 (10:42 +0200)
commitf92c21a28cd856834249a008771b2f002e477a39
tree793ce39525e1ce1273528b41d75b5d3eae06831d
parentc5d6dd80b54b61fcebbd2914de79d04d12d5b8f8
pf: depessimize table handling

Creating tables and zeroing their counters induces excessive IPIs (14
per table), which in turns kills single- and multi-threaded performance.

Work around the problem by extending per-CPU counters with a general
counter populated on "zeroing" requests -- it stores the currently found
sum. Then requests to report the current value are the sum of per-CPU
counters subtracted by the saved value.

Sample timings when loading a config with 100k tables on a 104-way box:

stock:

pfctl -f tables100000.conf  0.39s user 69.37s system 99% cpu 1:09.76 total
pfctl -f tables100000.conf  0.40s user 68.14s system 99% cpu 1:08.54 total

patched:

pfctl -f tables100000.conf  0.35s user 6.41s system 99% cpu 6.771 total
pfctl -f tables100000.conf  0.48s user 6.47s system 99% cpu 6.949 total

Reviewed by: kp (previous version)
Sponsored by: Rubicon Communications, LLC ("Netgate")
sys/net/pfvar.h
sys/netpfil/pf/pf_table.c