From owner-freebsd-current@freebsd.org Mon Aug 1 20:21:48 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57526BAAB45 for ; Mon, 1 Aug 2016 20:21:48 +0000 (UTC) (envelope-from jhb@freebsd.org) 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 37B921619 for ; Mon, 1 Aug 2016 20:21:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2764DB97D; Mon, 1 Aug 2016 16:21:47 -0400 (EDT) From: John Baldwin To: Mateusz Guzik Cc: Konstantin Belousov , freebsd-current@freebsd.org Subject: Re: [PATCH] randomized delay in locking primitives, take 2 Date: Mon, 01 Aug 2016 13:21:44 -0700 Message-ID: <3455593.kNdxUc5UIq@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20160801200842.GC24633@dft-labs.eu> References: <20160731095706.GB9408@dft-labs.eu> <15005477.9uZ5EJCdhW@ralph.baldwin.cx> <20160801200842.GC24633@dft-labs.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 01 Aug 2016 16:21:47 -0400 (EDT) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 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: Mon, 01 Aug 2016 20:21:48 -0000 On Monday, August 01, 2016 10:08:43 PM Mateusz Guzik wrote: > On Mon, Aug 01, 2016 at 11:37:50AM -0700, John Baldwin wrote: > > On Sunday, July 31, 2016 02:41:13 PM Mateusz Guzik wrote: > > > On Sun, Jul 31, 2016 at 01:49:28PM +0300, Konstantin Belousov wrote: > > > [snip] > > > > > > After an irc discussion, the following was produced (also available at: > > > https://people.freebsd.org/~mjg/lock_backoff_complete4.diff): > > > > > > Differences: > > > - uint64_t usage was converted to u_int (also see r303584) > > > - currently unused features (cap limit and return value) were removed > > > - lock_delay args got packed into a dedicated structure > > > > lock_delay_enabled declaration seems to be stale? > > > > Oops, thanks. > > > I would maybe just provide a "standard" lock_delay_init function that the > > sysinit's use rather than duplicating the same exact code 3 times. I'm > > not sure we really want to use different tunables for different lock types > > anyway. (Alternatively we could even just have a single 'config' variable > > that is a global. We can always revisit this in the future if we find that > > we need that granularity, but it would remove an extra pointer indirection > > if you just had a single 'lock_delay_config' that was exported as a global > > for now and initialized in a single SYSINIT.) > > > > The per-lock type config is partially an artifact of the real version of > the patch which has different configs per state of the lock, see loops > with rowner_loops in the current implementation of rw and sx locks and > this is were it mattered. It was cut off from this patch for simplicity > (90% of the benefit for 10% of the work). > > That said, fine tuned it does matter for "mere" spinning as well but > here I put very low values on purpose. > > Putting them all in one config makes for a small compatibility issue, > where debug.lock.delay_* sysctls would disappear later. > > So I would prefer to just keep this as I don't think it matters much. Ok. This is also something we can change later if need to. It doesn't affect the ABI, etc. -- John Baldwin