From owner-freebsd-current@FreeBSD.ORG Tue Jun 1 17:19:30 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 415F81065675; Tue, 1 Jun 2010 17:19:30 +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 10C7C8FC14; Tue, 1 Jun 2010 17:19:30 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id AE79B46C0C; Tue, 1 Jun 2010 13:19:29 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id E44198A025; Tue, 1 Jun 2010 13:19:28 -0400 (EDT) From: John Baldwin To: Kostik Belousov Date: Tue, 1 Jun 2010 13:19:22 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <20100530143034.GH43302@hades.panopticon> <201006011141.09699.jhb@freebsd.org> <20100601170526.GJ83316@deviant.kiev.zoral.com.ua> In-Reply-To: <20100601170526.GJ83316@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201006011319.22275.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 01 Jun 2010 13:19:28 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-current@freebsd.org, freebsd-stable@freebsd.org, Dmitry Marakasov Subject: Re: need better POSIX semaphore support X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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, 01 Jun 2010 17:19:30 -0000 On Tuesday 01 June 2010 1:05:26 pm Kostik Belousov wrote: > On Tue, Jun 01, 2010 at 11:41:09AM -0400, John Baldwin wrote: > > On Sunday 30 May 2010 11:06:22 am Kostik Belousov wrote: > > > On Sun, May 30, 2010 at 06:30:35PM +0400, Dmitry Marakasov wrote: > > > > Hi! > > > > > > > > Not long ago, POSIX semaphores support was enabled by default as it's > > > > becoming more widely used, by e.g. firefox. However, the support > > > > for these is still incomplete: we only have systemwide limit of 30 > > > > semaphores, and that doesn't seem to be configurable neither online with > > > > sysctl, nor at boottime from loader.conf. I only was able to raise > > > > semaphore count by changing SEM_MAX in kernel sources. > > > > > > > > The real appliaction which needs more semaphores is lightspark > > > > (graphics/lightspark-devel) flash plugin - it uses ~40 sems for simple > > > > clips and ~250 for something like youtube videos. > > > > > > > > Until there more apps that require proper semaphore support, I guess > > > > we need to improve it asap. Given the amount of memory used by ksem, > > > > the least can be done is SEM_MAX bumped up to 5120 or so for > > > > non-embedded kernels. 5120 semaphores require just 644k of kernel > > > > memory (judging by vmstat), and is "ought to be enough for anybody". > > > > Another good thing would be to make it configurable at boot-time > > > > or even better in runtime. > > > > > > HEAD contains different implementation. Apparently, it did not made > > > into stable/8 yet, so it will not appear in the 8.1. > > > > The one thing I don't like about this approach is you can write the > > variable even when sem.ko isn't loaded. The SEM_* values should really > > only exist when sem.ko is loaded I think, which requires moving them > > into uipc_sem.c. > > I think the values should exist always, because sysconf(3) returns > error (i.e. -1 and errno set) when sysctl fails. sysconf(3) interprets > 0 result as "feature not supported". > > I modified the patch to only allow change of value when the module is loaded. > Also, the module unload now clears mib. As usual, module unload races are > not handled. I think this looks good, thanks! -- John Baldwin