Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Feb 2006 18:26:21 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 91580 for review
Message-ID:  <200602111826.k1BIQLrI082592@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=91580

Change 91580 by peter@peter_daintree on 2006/02/11 18:25:50

	Try making the nmbclusters sysctl actually do something.  Out of paranoia,
	do not allow it to reduce the current value - ie: increase only.  It would
	probably work, but wouldn't be healthy to the network stack if we allowed it
	to be run into the ground.

Affected files ...

.. //depot/projects/hammer/sys/kern/kern_mbuf.c#15 edit

Differences ...

==== //depot/projects/hammer/sys/kern/kern_mbuf.c#15 (text+ko) ====

@@ -111,9 +111,24 @@
 SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_ANY, tunable_mbinit, NULL);
 
 SYSCTL_DECL(_kern_ipc);
-/* XXX: These should be tuneables. Can't change UMA limits on the fly. */
-SYSCTL_INT(_kern_ipc, OID_AUTO, nmbclusters, CTLFLAG_RW, &nmbclusters, 0,
-    "Maximum number of mbuf clusters allowed");
+static int
+nmbcheck(SYSCTL_HANDLER_ARGS)
+{
+	int error, oldnmbclusters;
+
+	oldnmbclusters = nmbclusters;
+	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
+	if (error == 0 && req->newptr) {
+		if (nmbclusters < oldnmbclusters) {
+			nmbclusters = oldnmbclusters;
+			return (EINVAL);
+		}
+		uma_zone_set_max(zone_clust, nmbclusters);
+	}
+	return (error);
+}
+SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbclusters, CTLTYPE_INT|CTLFLAG_RW,
+    &nmbclusters, 0, nmbcheck, "IU", "Maximum number of mbuf clusters allowed");
 SYSCTL_INT(_kern_ipc, OID_AUTO, nmbjumbo4, CTLFLAG_RW, &nmbjumbo4, 0,
     "Maximum number of mbuf 4k jumbo clusters allowed");
 SYSCTL_INT(_kern_ipc, OID_AUTO, nmbjumbo9, CTLFLAG_RW, &nmbjumbo9, 0,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602111826.k1BIQLrI082592>