Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Apr 2008 09:30:27 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Subject:   Re: f_offset
Message-ID:  <200804160930.27981.jhb@freebsd.org>
In-Reply-To: <20080412132457.W43186@desktop>
References:  <20080412132457.W43186@desktop>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804160930.27981.jhb>