Page MenuHomeFreeBSD

pf: Replace rwlock on PF_RULES_LOCK with rmlock
ClosedPublic

Authored by farrokhi on May 20 2018, 3:47 PM.
Tags
None
Referenced Files
F115502156: D15502.id43127.diff
Thu, Apr 24, 1:48 PM
Unknown Object (File)
Tue, Apr 8, 6:10 PM
Unknown Object (File)
Thu, Apr 3, 3:25 AM
Unknown Object (File)
Mar 21 2025, 1:46 PM
Unknown Object (File)
Mar 16 2025, 3:17 PM
Unknown Object (File)
Feb 18 2025, 9:46 AM
Unknown Object (File)
Jan 20 2025, 4:58 AM
Unknown Object (File)
Jan 15 2025, 10:53 PM
Subscribers

Details

Summary

Given that PF_RULES_LOCK is a mostly read lock, I replaced the rwlock with rmlock.
This change improves packet processing rate in high pps environments.
While here, I am also eliminating all appearances of "sys/rwlock.h" includes since it is not used anymore.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16721
Build 16614: arc lint + arc unit

Event Timeline

Looks good at first glance.
I like the move of the sys/rmlock.h include into pfvar.h, so the header becomes more self-contained (i.e. you don't need extra includes to make your include of pfvar.h work). I'm running test builds for that, because I thought it broke when I tried. Perhaps I messed something else up though.

For others and for context: Olivier has tested this change and saw a 65% increase in packets per second through pf. We really, really want this change.

In D15502#327153, @kristof wrote:

Looks good at first glance.
I like the move of the sys/rmlock.h include into pfvar.h, so the header becomes more self-contained (i.e. you don't need extra includes to make your include of pfvar.h work). I'm running test builds for that, because I thought it broke when I tried. Perhaps I messed something else up though.

For others and for context: Olivier has tested this change and saw a 65% increase in packets per second through pf. We really, really want this change.

For the record, here is his performance test done by @olivier:

ocochardlabbe_2018-May-17.jpg (1×1 px, 140 KB)

Changes in pfvar.h and removal of rwlock.h includes broke the build (noted by @kristof). This updated patch unbreaks the build.

This revision was not accepted when it landed; it landed in state Needs Review.May 30 2018, 7:11 AM
This revision was automatically updated to reflect the committed changes.