lockless file descriptor lookup

Jeff Roberson jroberson at jroberson.net
Wed May 13 00:29:08 UTC 2009

On Tue, 12 May 2009, Ed Schouten wrote:

> Hello Jeff,
> * Jeff Roberson <jroberson at jroberson.net> wrote:
>> Once the file descriptor is resolved, we verify the path via the
>> descriptor table once more to ensure that it has not changed.  At this
>> point, we have a valid reference or we drop an invalid reference and
>> retry.
> It's nice to see someone stepped up to implement this. Just out of
> curiosity, have you done any benchmarks to see how many percent of the
> time a thread needs more than one attempt to obtain a valid reference on
> a common workload?
> Maybe it would be nice for diagnostic purposes to add two sysctls to
> obtain the amount of successful and unsuccessful attempts.

Hi Ed,

I have had trouble triggering it at all in testing.  I'd prefer not to 
commit the counters because they would re-introduce a global point of 
cache contention unless we made them per-cpu.

This effectively implements ll/sc semantics on all architectures via 
cmpset.  I suspect the overhead is minimal even in degenerate cases.


> -- 
> Ed Schouten <ed at 80386.nl>
> WWW: http://80386.nl/

More information about the freebsd-arch mailing list