vmstat's entries type

Oliver Fromme olli at lurza.secnetix.de
Fri Jul 28 13:54:49 UTC 2006


Brian Candler wrote:
 > John Baldwin wrote:
 > > 	lock incl counter
 > > 	jnc 1f
 > > 	lock incl counter+4
 > > 1:
 > 
 > That looks safe to me. How expensive is a forward jump like that, i.e. do
 > you get a pipeline bubble?

The jump is not executed only once out of 4 billion times,
so the processor's branch prediction should be handle to
optimize away it pretty well.  As far as I can tell, the
"lock" prefixes are _much_ more to worry about.

 > The 'polling' argument says just do
 > 
 >     lock incl counter
 > 
 > and poll all counters every 5 minutes, looking for a wrap. I think that's
 > almost certainly going to be cheaper, as long as you can keep track of where
 > all these counters are located.

It's not much cheaper (it still seems to need a "lock"),
and it's ugly, and there are situations where it can break,
e.g. if the counter is incremented fast enough to overflow
twice within the polling interval.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."
        -- Robert Firth


More information about the freebsd-current mailing list