From owner-svn-src-all@FreeBSD.ORG Sun Nov 2 17:59:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 996D721F; Sun, 2 Nov 2014 17:59:08 +0000 (UTC) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D72ADF36; Sun, 2 Nov 2014 17:59:07 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id q5so4730109wiv.11 for ; Sun, 02 Nov 2014 09:59:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=uhzy11nJBpY13HdXtHuA8exdv8+45Ez6Cy4xZIecPEU=; b=NS0YpH0NP52d+25Gb06lnVMna63EW4WEkrJLuiLvrkNfTJlC1ekiDIHa6YJ+8Xfale pJRV9RtXoh4vgu+DWyDRlTCkfQZvzl2W0SCB8LR8ezuIKYvZdefWYi2ZvpL4TQH7XVRb aRrVmm6nE8FgqAjmgfT8K6f19jjCVnF/G9djP+xZ6ykj+/zQvQoNVZEw6khO7QdYExe6 tPH5q8ADFPcePyl4Dj3GI+i35Kdcaw/9JRgdyNpY6h2n0GKQL2YNY6mh327pvRcFVZjD vHKXAY8cjSQAFWz8r3Y1od/kA5HrzwzsHGcGA8+weCAwUi71j35d0aBM8oRyN68YZgL3 I3kw== MIME-Version: 1.0 X-Received: by 10.194.191.163 with SMTP id gz3mr3435965wjc.114.1414951146077; Sun, 02 Nov 2014 09:59:06 -0800 (PST) Reply-To: attilio@FreeBSD.org Sender: asmrookie@gmail.com Received: by 10.217.69.73 with HTTP; Sun, 2 Nov 2014 09:59:06 -0800 (PST) In-Reply-To: References: <201411021310.sA2DAWmD003298@svn.freebsd.org> <20141102163728.GX53947@kib.kiev.ua> <20141102165916.GY53947@kib.kiev.ua> <20141102174958.GZ53947@kib.kiev.ua> Date: Sun, 2 Nov 2014 18:59:06 +0100 X-Google-Sender-Auth: yetJoBu3-oChSdYT0MLTwm4_4kU Message-ID: Subject: Re: svn commit: r273966 - in head: share/man/man9 sys/kern sys/sys From: Attilio Rao To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2014 17:59:08 -0000 On Sun, Nov 2, 2014 at 6:53 PM, Attilio Rao wrote: > On Sun, Nov 2, 2014 at 6:49 PM, Konstantin Belousov wrote: >> On Sun, Nov 02, 2014 at 06:07:20PM +0100, Attilio Rao wrote: >>> On Sun, Nov 2, 2014 at 5:59 PM, Konstantin Belousov wrote: >>> > It is easy and cheap to record the set of the owned lockmgr locks for >>> > current thread. I do not believe that we have a situation where more >>> > than 3 locks are held in one time. To give it some slack, we can record >>> > 8 locks shared-owned and do the check for recursion in LK_CAN_SHARE(). >>> > If the thread-locks table overflows, we could either panic() or fall >>> > back to indiscriminative deadlock avoidance (i.e. relying on the sole >>> > td_lk_slocks value). >>> >>> I don't think it is going to be cheap (and certainly it is not viable >>> for things like sx locks and rwlocks). >> sx and rw do not implement exclusive starvation avoidance. > > rw do. > It is believed for sx it should not be too helpful, on FreeBSD I've > never seen an sx that is particulary congested. > It can be added, however and the algorithm they would use is the same than rw. > >>> Checking for the owner chain anytime you acquire the lock is certainly >>> not I would call cheap. >> >> I did not proposed to verify owner chain. I said that it is easy to >> record the locks owned by current thread, only for current thread >> consumption. Below is the prototype. > > I think it is too expensive, think that this must happen for every shared lock. > I know we may not be using too many shared locks on lockmgr right now, > but it is not a good reason to make shared lock bloated and more > expensive on lockmgr. And to be honest, I find already wrong the fact that we don't have a faster path for lockmgr() (ie. inlined atomics). I think this sloppiness (at least on my side) cames on the fact that locking overhead is not a major factor for the performance of current lockmgr users. That doesn't mean, however, that we should have a slower primitive. Attilio -- Peace can only be achieved by understanding - A. Einstein