lockless file descriptor lookup
Jeff Roberson
jroberson at jroberson.net
Thu May 14 01:58:00 UTC 2009
On Wed, 13 May 2009, John Baldwin wrote:
> 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.
Yeah, I think I'll add a comment in the header too. pho has tested it
with some targeted tests and stress2 for a day or two. I'm going to
commit this evening so it gets as much exposure as possible before
release.
Thanks,
Jeff
>
> --
> John Baldwin
>
More information about the freebsd-arch
mailing list