From owner-freebsd-hackers@FreeBSD.ORG Thu May 14 21:58:21 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14D001065679 for ; Thu, 14 May 2009 21:58:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DAA6E8FC1A for ; Thu, 14 May 2009 21:58:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 8F9D846B0C; Thu, 14 May 2009 17:58:20 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 76FED8A025; Thu, 14 May 2009 17:58:14 -0400 (EDT) From: John Baldwin To: Ed Schouten Date: Thu, 14 May 2009 17:57:51 -0400 User-Agent: KMail/1.9.7 References: <200905111801.18767.jhb@freebsd.org> <20090514213426.GP58540@hoeg.nl> In-Reply-To: <20090514213426.GP58540@hoeg.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905141757.52144.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 14 May 2009 17:58:14 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: FreeBSD Hackers , jt@0xabadba.be Subject: Re: concurrent sysctl implementation X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 21:58:21 -0000 On Thursday 14 May 2009 5:34:26 pm Ed Schouten wrote: > * John Baldwin wrote: > > Well, in theory a bunch of "small" requests to SYSCTL_PROC() nodes that used > > sysctl_wire_old() (or whatever it is called) could cause the amount of user > > memory wired for sysctls to grow unbounded. Thus, allowing this limited > > concurrency is a tradeoff as there is a minimal (perhaps only theoretical at > > the moment) risk of removing the safety net. > > > > The patch is quite small, btw, because the locking for the sysctl tree already > > exists, and by using read locks, one can already allow concurrent sysctl > > requests. There is no need to add any new locks or restructure the sysctl > > tree, just to adjust the locking that is already present. It might be > > clearer, in fact, to split the sysctl memory lock back out into a separate > > lock. This would allow "small" sysctl requests to run concurrently with a > > single "large" request whereas in my suggestion in the earlier e-mail, > > the "large" request will block all other user requests until it finishes. > > > > I've actually gone ahead and done this below. > > Boohoo. I actually wanted jt to work on this, as a small exercise to > figure out the way locking primitives work in the kernel. No problem, > because I can think of dozens of other things. > > Is there a chance we can see this patch in 8.0? I like it that the > memlock is being picked up before we pick up the sysctl lock itself, > which makes a lot of sense. Yes, I can commit it. -- John Baldwin