f_offset

John Baldwin jhb at freebsd.org
Wed Apr 16 14:47:11 UTC 2008


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


More information about the freebsd-arch mailing list