tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Elide unnecessary full_sync in npf?



The attached patch avoids calling npf_config_sync -- which triggers
ebr_full_sync or pserialize_perform -- if there's nothing to GC.
Without this, npf triggers pserialize_perform once a second even if
there's nothing to do.  OK?
From 91b41b1ca4939bf141e615ed2a01a969b7f167b1 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Date: Tue, 3 Dec 2019 04:43:42 +0000
Subject: [PATCH] Skip npf_config_sync if nothing to do.

Saves an unnecessary pserialize_perform every second.
---
 sys/net/npf/npf_conndb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/net/npf/npf_conndb.c b/sys/net/npf/npf_conndb.c
index 5ece20ffb45e..00d9fb986302 100644
--- a/sys/net/npf/npf_conndb.c
+++ b/sys/net/npf/npf_conndb.c
@@ -371,7 +371,7 @@ npf_conndb_gc(npf_t *npf, npf_conndb_t *cd, bool flush, bool sync)
 	 * Note: drop the conn_lock (see the lock order).
 	 */
 	gcref = thmap_stage_gc(cd->cd_map);
-	if (sync) {
+	if (sync && (gcref || !LIST_EMPTY(&cd->cd_gclist))) {
 		npf_config_enter(npf);
 		npf_config_sync(npf);
 		npf_config_exit(npf);


Home | Main Index | Thread Index | Old Index