From owner-freebsd-arch@FreeBSD.ORG Wed Apr 16 14:47:11 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 233EA1065670 for ; Wed, 16 Apr 2008 14:47:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 1A18D8FC1A for ; Wed, 16 Apr 2008 14:47:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (unknown [208.65.88.170]) by elvis.mu.org (Postfix) with ESMTP id B46031A4D84; Wed, 16 Apr 2008 07:47:10 -0700 (PDT) From: John Baldwin To: freebsd-arch@freebsd.org Date: Wed, 16 Apr 2008 09:30:27 -0400 User-Agent: KMail/1.9.7 References: <20080412132457.W43186@desktop> In-Reply-To: <20080412132457.W43186@desktop> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200804160930.27981.jhb@freebsd.org> Cc: Subject: Re: 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: Wed, 16 Apr 2008 14:47:11 -0000 On Saturday 12 April 2008 07:51:15 pm Jeff Roberson wrote: > To maintain the existing semantics I'm simply going to add an exclusive > sx_xlock() around access to f_offset. This is done inconsistently today > which is fine from the perspective of the updates in most cases being > user-space races. However, f_offset is 64bit and can not be written > atomically on 32bit systems and so requires some extra synchronization > there. > > 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. -- John Baldwin