should we use atomic instructions to manipulate vmstats.v_wire_count?

Rick Macklem rick at
Mon Jan 14 07:32:18 PST 2008

> I noticed that vmstats.v_wire_count is incremented and decremented w/o
> protection.  In contrast, atomic instructions (from <atomic.h>) are
> used in freebsd.
> Is it a bug in dfly or is it intentional?

If it is just stats and not used for anything else (I have no idea if this
is the case, just going by the name), why bother. Without SMP protection
there is a miniscule likelyhood the value will be out by one, but if that
doesn't break any code, is it worth the overhead of SMP locking just to
ensure that?

In my NFS code, I've used a macro so the adopters can decide if the
overhead is worth it. (Personally, I don't think so, but??)


More information about the Kernel mailing list