ZFS committed to the FreeBSD base.

Dag-Erling Smørgrav des at des.no
Thu Apr 12 20:43:13 UTC 2007

Craig Boston <craig at xfoil.gank.org> writes:
> On Thu, Apr 12, 2007 at 11:06:03AM -0500, Rick C. Petty wrote:
> > Is there any way we could make the choice at boot time, by checking for
> > presence of the CX8 feature?  Either as something like:
> >
> > extern int feature_cx8;		/* or MIB variable */
> > #define CMPXCHG8(a)	(feature_cx8 ? { _asm "..." } : emulate_cmpxch8(a))
> 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.

Dag-Erling Smørgrav - des at des.no

More information about the freebsd-current mailing list