Page MenuHomeFreeBSD

pf: Stop using net_epoch to synchronize access to eth rules
ClosedPublic

Authored by markj on Mon, Feb 3, 7:30 PM.
Tags
None
Referenced Files
F109748261: D48822.diff
Sun, Feb 9, 1:18 AM
Unknown Object (File)
Thu, Feb 6, 11:12 PM
Unknown Object (File)
Thu, Feb 6, 7:27 PM
Unknown Object (File)
Wed, Feb 5, 8:24 AM
Unknown Object (File)
Tue, Feb 4, 10:58 PM
Unknown Object (File)
Tue, Feb 4, 5:21 PM
Unknown Object (File)
Tue, Feb 4, 2:22 AM
Unknown Object (File)
Tue, Feb 4, 12:13 AM

Details

Summary

Commit 20c4899a8eea4 modified pf_test_eth_rule() to not acquire the
rules read lock, so pf_commit_eth() was changed to wait until the
now-inactive rules are no longer in use before freeing them. In
particular, it uses the net_epoch to schedule callbacks once the
inactive rules are no longer visible to packet processing threads.

However, since commit 812839e5aaaf4, pf_test_eth_rule() acquires the
rules read lock, so this deferred action is unneeded. This patch
reverts a portion of 20c4899a8eea4 such that we avoid using deferred
callbacks to free inactive rules.

The main motivation is performance: epoch_drain_callbacks() is quite
slow, especially on busy systems, and its use in the DIOCXBEGIN handler
causes long stalls in relayd when reloading configuration. I am working
on trying to make epoch_drain_callbacks() smarter, but here it's better
to simply do less work.

Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable