PERFORCE change 91580 for review

Robert Watson rwatson at FreeBSD.org
Sat Feb 11 15:33:51 PST 2006


On Sat, 11 Feb 2006, Peter Wemm wrote:

> http://perforce.freebsd.org/chv.cgi?CH=91580
>
> Change 91580 by peter at 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.

...

> -/* 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);

Should this be:

 	error = sysctl_handle_int(oidp, &nmbclusters, NULL, req);

> +	if (error == 0 && req->newptr) {
> +		if (nmbclusters < oldnmbclusters) {
> +			nmbclusters = oldnmbclusters;
> +			return (EINVAL);
> +		}

Would it be better to use a newnmbclusters variable so as to avoid frobbing 
the global back and forth in the event that you abort the change?

If the value does change, we also don't need to call into UMA, we can just 
return.

Robert N M Watson


More information about the p4-projects mailing list