]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pf: Add a new zone for per-table entry counters.
authormarkj <markj@FreeBSD.org>
Sat, 16 May 2020 00:28:12 +0000 (00:28 +0000)
committermarkj <markj@FreeBSD.org>
Sat, 16 May 2020 00:28:12 +0000 (00:28 +0000)
commit68806c40444554fb41a52449acb7a55c1eeee4dc
tree086238d2509cdb4ebbe817b23a604232169b3531
parentf152004cfe75bf29311cca2aaa99b7deb4f1b488
pf: Add a new zone for per-table entry counters.

Right now we optionally allocate 8 counters per table entry, so in
addition to memory consumed by counters, we require 8 pointers worth of
space in each entry even when counters are not allocated (the default).

Instead, define a UMA zone that returns contiguous per-CPU counter
arrays for use in table entries.  On amd64 this reduces sizeof(struct
pfr_kentry) from 216 to 160.  The smaller size also results in better
slab efficiency, so memory usage for large tables is reduced by about
28%.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24843
sys/net/pfvar.h
sys/netpfil/pf/pf_table.c