From owner-svn-src-all@FreeBSD.ORG Sun Nov 2 17:53:48 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 13463FBE; Sun, 2 Nov 2014 17:53:48 +0000 (UTC) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [IPv6:2a00:1450:400c:c05::234]) (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 51D0BF01; Sun, 2 Nov 2014 17:53:47 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id hi2so4721602wib.13 for ; Sun, 02 Nov 2014 09:53:44 -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=hkRLGrltbcqMqYOlWic65KaEeA6CuQo/h+QY8FgPi50=; b=YBfbtTZY90BAArFYEVk4/1EHr8utsgKsLbgNQr6ATrGS8NLsLYAp54io5K8FvHwtRp KLjDBl49Rq2GyUGsRmXwj3Sc/rtMAlDIFFvd26HYAP9UWd3PrmA3QJJdtcDbft14Cn7X 5vHm2LsyVxsVzyixslrpI14hFQo+H6VzHEvSUUIKLb40cAtiMYFuLDKgIsiP3ES/yNzI bZWkai5ThPDQu5O4ZhPlqxzzACESGhV7SY3WwAiotsiqSDM4xbyh+qG6kRh6BzmjjhoJ WSc0U28HDZW6L3+sJO82uySdzQhF8wbs8hoEqn2USKbhZGNbPWmmBcvqtSX+hvczZvMU m/vA== MIME-Version: 1.0 X-Received: by 10.180.100.129 with SMTP id ey1mr11302479wib.28.1414950824808; Sun, 02 Nov 2014 09:53:44 -0800 (PST) Reply-To: attilio@FreeBSD.org Sender: asmrookie@gmail.com Received: by 10.217.69.73 with HTTP; Sun, 2 Nov 2014 09:53:44 -0800 (PST) In-Reply-To: <20141102174958.GZ53947@kib.kiev.ua> 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:53:44 +0100 X-Google-Sender-Auth: OoaGL0FPCr04HyX-HXpPV-l0zNk 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:53:48 -0000 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. Attilio -- Peace can only be achieved by understanding - A. Einstein