Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 May 2009 09:35:42 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Subject:   Re: lockless file descriptor lookup
Message-ID:  <200905130935.42795.jhb@freebsd.org>
In-Reply-To: <alpine.BSF.2.00.0905111720280.981@desktop>
References:  <alpine.BSF.2.00.0905111720280.981@desktop>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 11 May 2009 11:32:17 pm Jeff Roberson wrote:
> http://people.freebsd.org/~jeff/locklessfd.diff
> 
> This patch implements a lockless lookup path for file descriptors.  The 
> meat of the algorithm is in fget_unlocked().  This returns a referenced 
> file descriptor, unlike fget_locked().  In the common case this reduces 
> the number of atomics required for fget() while allowing for lookups to 
> proceed concurrently with modifications to the table and preventing 
> preemption from causing context switches.

Looks good.  My only comment would be to not remove the 'hold' comment 
completely from _fget(), but instead say that it always returns a refcount 
that must be dropped.  Basically:

* The file's refcount will be bumped on return.  It should be dropped
* with fdrop().

or something like that in place of the old paragraph about the 'hold' 
parameter.

-- 
John Baldwin



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