ZFS committed to the FreeBSD base.
Andrew Reilly
andrew-freebsd at areilly.bpc-users.org
Fri Apr 13 04:54:14 UTC 2007
On Thu, Apr 12, 2007 at 10:43:05PM +0200, Dag-Erling Sm?rgrav wrote:
> Craig Boston <craig at xfoil.gank.org> writes:
> > For something this low level my opinion is it's better to stay with
> > compile time options. After all, in the above example, cmpxchg8 is a
> > single machine instruction. How much overhead does it add to retrieve a
> > variable from memory and check it, then jump to the correct place?
> > Enough that it outweighs the benefit of using that instruction in the
> > first place?
>
> I don't think it matters. Contrary to popular belief, atomic
> operations are *expensive*. In the best case, on a UP machine, they
> stall the pipeline. In the worst case, on an SMP machine, they stall
> the entire memory bus.
Apart from the fact that you are correct, how long is the
instruction encoding of cmpxchg8? Perhaps it could be patched
in at runtime, in place of the call to the emultaion, the way of
on-the-fly linking in shared libraries and some floating point
emulation/inline-ers?
--
Andrew
More information about the freebsd-current
mailing list