summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_base.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2003-03-02 18:04:10 +0000
committerharti <harti@FreeBSD.org>2003-03-02 18:04:10 +0000
commit5b5b5483d30b41be53c35c658c1bb78213f93922 (patch)
tree11e68af8d51a4337fabe102930a2eba1ba2ea3d1 /sys/netgraph/ng_base.c
parent2756b6c9641bd9899a346582c191310de25cccc5 (diff)
downloadFreeBSD-src-5b5b5483d30b41be53c35c658c1bb78213f93922.zip
FreeBSD-src-5b5b5483d30b41be53c35c658c1bb78213f93922.tar.gz
Add two loader tuneables that allow one to change the maximum number of
queue items that can be allocated by netgraph and the number of free queue items that are cached on a private list. Netgraph places an upper limit on the number of queue items it may allocate. When there is a large number of netgraph messages travelling through the system (100k/sec and more) there is a high probability, that messages get queued at the nodes and netgraph runs out of queue items. In this case the data flow through netgraph gets blocked. The tuneable for the number of free items lets one trade memory for performance. The tunables are also available as read-only sysctls. PR: kern/47393 Reviewed by: julian Approved by: jake (mentor)
Diffstat (limited to 'sys/netgraph/ng_base.c')
-rw-r--r--sys/netgraph/ng_base.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index eb5a8eb..4c8dde3 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -3017,8 +3017,18 @@ SYSCTL_INT(_net_graph, OID_AUTO, msg_version, CTLFLAG_RD, 0, NG_VERSION, "");
static int allocated; /* number of items malloc'd */
+
static int maxalloc = 128; /* limit the damage of a leak */
-static const int ngqfreemax = 64;/* cache at most this many */
+static int ngqfreemax = 64;/* cache at most this many */
+
+TUNABLE_INT("net.graph.maxalloc", &maxalloc);
+SYSCTL_INT(_net_graph, OID_AUTO, maxalloc, CTLFLAG_RD, &maxalloc,
+ 0, "Maximum number of queue items to allocate");
+
+TUNABLE_INT("net.graph.ngqfreemax", &ngqfreemax);
+SYSCTL_INT(_net_graph, OID_AUTO, ngqfreemax, CTLFLAG_RD, &ngqfreemax,
+ 0, "Maximum number of free queue items to cache");
+
static const int ngqfreelow = 4; /* try malloc if free < this */
static volatile int ngqfreesize; /* number of cached entries */
#ifdef NETGRAPH_DEBUG
OpenPOWER on IntegriCloud