]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pfctl: cache getprotobynumber results
authorMateusz Guzik <mjg@FreeBSD.org>
Thu, 1 Jul 2021 19:25:43 +0000 (21:25 +0200)
committerMateusz Guzik <mjg@FreeBSD.org>
Mon, 5 Jul 2021 11:38:58 +0000 (11:38 +0000)
commit98fd94dc83319db1b6bfc9f741245eefb0af7911
tree947238911a0068e92353e005a6819adb50020e8b
parent3f136d9fea869515900bcda1ef6533f5804d819c
pfctl: cache getprotobynumber results

As for example pfctl -ss keeps calling it, it saves a lot of overhead
from elided parsing of /etc/nsswitch.conf and /etc/protocols.

Sample result when running a pre-nvlist binary with nfs root and dumping
7 mln states:
before: 24.817u 62.993s 1:28.52 99.1%
after: 8.064u 1.117s 0:18.87 48.5%

Idea by Jim Thompson

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 858937bea4599d254a97ee6321683f8629604e15)
sbin/pfctl/parse.y
sbin/pfctl/pf_print_state.c
sbin/pfctl/pfctl.c
sbin/pfctl/pfctl.h
sbin/pfctl/pfctl_parser.c