]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pf: Don't allocate per-table entry counters unless required.
authormarkj <markj@FreeBSD.org>
Mon, 11 May 2020 18:47:38 +0000 (18:47 +0000)
committermarkj <markj@FreeBSD.org>
Mon, 11 May 2020 18:47:38 +0000 (18:47 +0000)
commit5ffbc764fb1d6980bafb5bd39ac2ab6e2d80da19
tree11087250aada7b824e27ac148dd900230e44c830
parent83527e52a1e151f3ee20f4c35f81cf21915c9f15
pf: Don't allocate per-table entry counters unless required.

pf by default does not do per-table address accounting unless the
"counters" keyword is specified in the corresponding pf.conf table
definition.  Yet, we always allocate 12 per-CPU counters per table.  For
large tables this carries a lot of overhead, so only allocate counters
when they will actually be used.

A further enhancement might be to use a dedicated UMA zone to allocate
counter arrays for table entries, since close to half of the structure
size comes from counter pointers.  A related issue is the cost of
zeroing counters, since counter_u64_zero() calls smp_rendezvous() on
some architectures.

Reported by: loos, Jim Pingle <jimp@netgate.com>
Reviewed by: kp
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D24803
share/man/man5/pf.conf.5
sys/netpfil/pf/pf_table.c