From owner-freebsd-arch@FreeBSD.ORG Thu Apr 17 03:27:45 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 020711065673 for ; Thu, 17 Apr 2008 03:27:45 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.174]) by mx1.freebsd.org (Postfix) with ESMTP id D37F18FC1D for ; Thu, 17 Apr 2008 03:27:44 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by wf-out-1314.google.com with SMTP id 25so2688438wfa.7 for ; Wed, 16 Apr 2008 20:27:44 -0700 (PDT) Received: by 10.142.231.7 with SMTP id d7mr244631wfh.194.1208401215017; Wed, 16 Apr 2008 20:00:15 -0700 (PDT) Received: from ?10.0.1.199? ( [24.94.72.120]) by mx.google.com with ESMTPS id 9sm19241939wfc.16.2008.04.16.20.00.12 (version=SSLv3 cipher=OTHER); Wed, 16 Apr 2008 20:00:13 -0700 (PDT) Date: Wed, 16 Apr 2008 17:00:52 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: John Baldwin , attilio@freebsd.org In-Reply-To: <200804160930.27981.jhb@freebsd.org> Message-ID: <20080416165553.U959@desktop> References: <20080412132457.W43186@desktop> <200804160930.27981.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-arch@freebsd.org Subject: 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 03:27:45 -0000 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. For the !WITNESS case we need only the name pointer, the flags, recurse count, and actual lock uintptr_t. This reduces the overhead to 3 pointers size on 64bit. We could either conditionally compile WITNESS support, which has unpleasant side effects for binary modules, or use secondary storage with a hash similar to what I did with LOCK_PROFILING. I think it's time to seriously consider this. Thanks, Jeff > > -- > John Baldwin >