From owner-svn-src-all@FreeBSD.ORG Sun Nov 2 22:38:00 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 7190EFE9; Sun, 2 Nov 2014 22:38:00 +0000 (UTC) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) (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 AEE12E01; Sun, 2 Nov 2014 22:37:59 +0000 (UTC) Received: by mail-wg0-f49.google.com with SMTP id x13so11203348wgg.8 for ; Sun, 02 Nov 2014 14:37:58 -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=1O17jyQP5qtgv8tlaVGEQfml/hfWhBlTuSn65pgxLjw=; b=NsIsLND0kmNbeRUUdIqd7G2oz3itDKcUBD6PvQE+UO/+HrH1b/8SsAO7yAthpuE6rH OIrXUNNarvH4tYcQ2d9IqoqzZSsHQJYhpNSKeO91thkViGA1thLYSvymaegHwP+IXcef IYNaWmIpQ+24q+NOCJyFeomwTO6z0rYvsewVewzGes2h9MpqQcy04gyKKBgE+X+UAG66 wMln9zbRkxr912kDV6ti8DlBXBCxT81CM6ZUhN74k9O/yL8/2lkEUCFBAtKLfeZP9Icz b2aCN/8az1ggqwPw0ZUD4hsT9OeWVGA3cGleJaQiMOx/l4F6nCvpxmNGVTbW0rL0+hec sWfw== MIME-Version: 1.0 X-Received: by 10.180.19.234 with SMTP id i10mr12470034wie.28.1414967878070; Sun, 02 Nov 2014 14:37:58 -0800 (PST) Reply-To: attilio@FreeBSD.org Sender: asmrookie@gmail.com Received: by 10.217.69.73 with HTTP; Sun, 2 Nov 2014 14:37:57 -0800 (PST) In-Reply-To: <20141102213819.GF53947@kib.kiev.ua> References: <201411021310.sA2DAWmD003298@svn.freebsd.org> <20141102163728.GX53947@kib.kiev.ua> <20141102165916.GY53947@kib.kiev.ua> <20141102174958.GZ53947@kib.kiev.ua> <20141102191029.GA53947@kib.kiev.ua> <20141102213819.GF53947@kib.kiev.ua> Date: Sun, 2 Nov 2014 23:37:57 +0100 X-Google-Sender-Auth: GwaoGpbj76ZJUJhV4ISIQi8gYJk 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 22:38:00 -0000 On Sun, Nov 2, 2014 at 10:38 PM, Konstantin Belousov wrote: > On Sun, Nov 02, 2014 at 10:17:26PM +0100, Attilio Rao wrote: >> On Sun, Nov 2, 2014 at 8:10 PM, Konstantin Belousov wrote: >> > On Sun, Nov 02, 2014 at 06:53:44PM +0100, Attilio Rao wrote: >> >> > 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. >> > >> > It can be significantly simplified, if the array of lock pointers is >> > kept dense. Then the only non-trivial operation is unlock out of order, >> > when the array have to be compacted. >> > >> > The code adds one write and n reads on shared lock, where n is the >> > number of shared-locked locks already owned by thread. Typical n is 0 >> > or 1. On unlock, if done in order, the code adds one read; unordered >> > unlock shuffles array elements. Again, for typical lock nesting of 2, >> > this means one read and one write, and even this is rare. All reads and >> > writes are for thread-local memory. >> > >> > I am not going to spend any more time on this if people do not consider >> > the lock tracking worth it. Otherwise, I will benchmark the patch. >> >> I think that your initial patch (what is in head now) is a better approach. >> I would just make it a lockinit() flag to make it less alien to the KPI. >> > > Ok. > > Can you explain what would the proposed lockinit() flag do ? What should > it change comparing with the current code ? You now provide LK_NODDLKTREAT on a call basis. The lockinit() flag would embed this into the lock attribute and make it always real, without the need for the callers to provide LK_NODDLKTREAT on a call basis. Attilio -- Peace can only be achieved by understanding - A. Einstein