From owner-freebsd-arch@FreeBSD.ORG Thu Apr 17 13:26:28 2008 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E9EF1065674 for ; Thu, 17 Apr 2008 13:26:28 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.224]) by mx1.freebsd.org (Postfix) with ESMTP id 679F28FC1B for ; Thu, 17 Apr 2008 13:26:28 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by wr-out-0506.google.com with SMTP id 50so42631wra.13 for ; Thu, 17 Apr 2008 06:26:27 -0700 (PDT) Received: by 10.114.166.1 with SMTP id o1mr1413658wae.5.1208438786586; Thu, 17 Apr 2008 06:26:26 -0700 (PDT) Received: from ?10.0.1.199? ( [24.94.72.120]) by mx.google.com with ESMTPS id n37sm22034917wag.24.2008.04.17.06.26.25 (version=SSLv3 cipher=OTHER); Thu, 17 Apr 2008 06:26:25 -0700 (PDT) Date: Thu, 17 Apr 2008 03:26:42 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Attilio Rao In-Reply-To: <3bbf2fe10804170459j4933ed09ubfd22035ff27d5d6@mail.gmail.com> Message-ID: <20080417032638.T983@desktop> References: <20080412132457.W43186@desktop> <200804160930.27981.jhb@freebsd.org> <20080416165553.U959@desktop> <3bbf2fe10804170459j4933ed09ubfd22035ff27d5d6@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-arch@freebsd.org Subject: Re: synchronization primitive size (was f_offset) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Apr 2008 13:26:28 -0000 On Thu, 17 Apr 2008, Attilio Rao wrote: > 2008/4/17, Jeff Roberson : >> >> On Wed, 16 Apr 2008, John Baldwin wrote: >> >> >>> On Saturday 12 April 2008 07:51:15 pm Jeff Roberson wrote: >>> >>>> The sx lock will nearly double the size of struct file. Although it's >>>> lost some weight in 8.0 that is quite unfortunate. However, the method >> of >>>> using LOCKED & WAITING flags, msleep and a mutex has ruined performance >> in >>>> too many cases to continue using it. >>>> >>> >>> You could use a pool of sx locks and hash the file pointer to get an >> offset >>> (ala the mtx pools) to avoid bloating struct file if desired. >>> >> >> This would not be a good idea since the sx is held over actual io. Any >> collisions would mean blocking unrelated files/vnodes. >> >> I think we should use the right synchronization primitive for the job. If >> people are upset at how much space overhead that adds we need to rethink how >> big our synchronization primitives are. >> >> If we move the *_recurse fields into lock object they can buddy up with >> lo_flags potentially saving 8 bytes of pading waste on 64bit architectures. > > it is not possible. > Lower 16 bits of lo_flags are currently used for special flags, > external flags, by sx and lockmgr and they are intented to be > 'reserved'. I meant that they should be placed adjacent to each other so that neither one of them requires padding on 64bit machines. Not that the flags and recurse should be within the same member. > > Btw, I worked some in this week-end about this issue. > I just broke lock_object into for WITNESS (moving there lo_type and > lod_* fields), I embedded the recursion counter in the lockmgr > structure and statically sized lo_flags and lo_recurse to 32 bits. For > the !WITNESS case the size of lock_object was 2/3 and for locking > primitives 1/2. It requires, however, ABI breakage for WITNESS which > is something we don't want really. What do you think about witness operating as LOCK_PROFILING does now? Each lock would be looked up in a table to get the required information rather than embedding it in the datastructure. This would solve the ABI issue. > > Thanks, > Attilio > > > -- > Peace can only be achieved by understanding - A. Einstein >