From owner-freebsd-current@FreeBSD.ORG Tue Jan 20 19:02:47 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E86127AA; Tue, 20 Jan 2015 19:02:47 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2B54BCF; Tue, 20 Jan 2015 19:02:47 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AF7A3B9A5; Tue, 20 Jan 2015 14:02:46 -0500 (EST) From: John Baldwin To: freebsd-current@freebsd.org Subject: Re: [PATCH] nmbclusters should be always positive Date: Tue, 20 Jan 2015 11:19:23 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201501201119.23123.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 20 Jan 2015 14:02:46 -0500 (EST) Cc: Davide Italiano X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jan 2015 19:02:48 -0000 On Monday, January 19, 2015 6:12:25 pm Davide Italiano wrote: > Currently, the following is allowed in FreeBSD: > > root@rabbit1:/home/davide/udp-clt # sysctl kern.ipc.nmbclusters=2147483647 > kern.ipc.nmbclusters: 2036598 -> -2147483648 > > The following is an attempt of fixing. > I also think nmbcluster should actually be u_int and not it, but this > is a discussion for another day, maybe. > > diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c > index 7ab6509..15b38a9 100644 > --- a/sys/kern/kern_mbuf.c > +++ b/sys/kern/kern_mbuf.c > @@ -162,7 +162,7 @@ sysctl_nmbclusters(SYSCTL_HANDLER_ARGS) > newnmbclusters = nmbclusters; > error = sysctl_handle_int(oidp, &newnmbclusters, 0, req); > if (error == 0 && req->newptr && newnmbclusters != nmbclusters) { > - if (newnmbclusters > nmbclusters && > + if (newnmbclusters > 0 && newnmbclusters > nmbclusters && > nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + > nmbjumbo16) { > nmbclusters = newnmbclusters; > nmbclusters = uma_zone_set_max(zone_clust, nmbclusters); 1) If you fix this one you need to fix the other handlers in this file (all the jumbo ones, etc.) 2) Shouldn't the 'newnmbclusters > nmbclusters' check catch this already? That should fail right? Might be worth figuring out why it isn't. -- John Baldwin