From owner-svn-src-all@FreeBSD.ORG Sun Nov 2 21:17:28 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 D2B1BD96; Sun, 2 Nov 2014 21:17:28 +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 1EB1477D; Sun, 2 Nov 2014 21:17:27 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id q5so4952583wiv.17 for ; Sun, 02 Nov 2014 13:17:26 -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=ETeiA1zWEkBJl5juEf+j8jjODR4lBheLsHUQSgaAHKo=; b=pJfX8taKXqMhX49a595PsPOK7voqqT1dDx0AVUAqqEfnv4y5v6wl4YljQZJ5MtRvAW 5RCjQujQ0Uj+x+81OUCPCC7dKcMvmQhFVMiteF3HbeMtkaphwBoR904obe2KK0MNPnaS YIXYr9s/RGH3TazM2XCOPDxVw1ow02pEvFqk0misdo5r/ggelOm6fqTJGE87Lo3ndpLN ssxUE1NOMbVKmivbJYOT1vvWMq0Bqto3/1LBB86I3oZKV7aoIj0+Y+gwir+84/1AuGcs bgxEeuH4vVyRzmJFSYSrdTlek+aiUyII8wyaq6X/iFZzJiStJcMi7EI52Req8ScWIfHv tW2g== MIME-Version: 1.0 X-Received: by 10.180.98.169 with SMTP id ej9mr2251005wib.1.1414963046416; Sun, 02 Nov 2014 13:17:26 -0800 (PST) Reply-To: attilio@FreeBSD.org Sender: asmrookie@gmail.com Received: by 10.217.69.73 with HTTP; Sun, 2 Nov 2014 13:17:26 -0800 (PST) In-Reply-To: <20141102191029.GA53947@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> Date: Sun, 2 Nov 2014 22:17:26 +0100 X-Google-Sender-Auth: o_MoqWxjz3_6JNU7a7Xw8HUuE1A 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 21:17:29 -0000 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. Attilio -- Peace can only be achieved by understanding - A. Einstein