aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_bridge.c
diff options
context:
space:
mode:
authorLutz Donnerhacke <donner@FreeBSD.org>2021-02-11 22:59:11 +0000
committerLutz Donnerhacke <donner@FreeBSD.org>2021-05-13 19:14:36 +0000
commit4dfe70fdbda05453e824bc9edfc0d09eab7b2929 (patch)
tree88a1909f41ad7e71bf23261278c6919593d381a3 /sys/netgraph/ng_bridge.c
parentf59127dac5ca0be3648ecc0a031a21e472afb133 (diff)
downloadsrc-4dfe70fdbda05453e824bc9edfc0d09eab7b2929.tar.gz
src-4dfe70fdbda05453e824bc9edfc0d09eab7b2929.zip
netgraph/ng_bridge: Avoid cache thrashing
Hint the compiler, that this update is needed at most once per second. Only in this case the memory line needs to be written. This will reduce the amount of cache trashing during forward of most frames. Suggested by: zec Approved by: zec MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28601
Diffstat (limited to 'sys/netgraph/ng_bridge.c')
-rw-r--r--sys/netgraph/ng_bridge.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
index 470c0f05f18d..820c93515490 100644
--- a/sys/netgraph/ng_bridge.c
+++ b/sys/netgraph/ng_bridge.c
@@ -788,7 +788,8 @@ ng_bridge_rcvdata(hook_p hook, item_p item)
* This is safe without locking, because it's
* the only operation during shared access.
*/
- host->staleness = 0;
+ if (__predict_false(host->staleness > 0))
+ host->staleness = 0;
if ((host == NULL && ctx.incoming->learnMac) ||
(host != NULL && host->link != ctx.incoming)) {