Re: vmstat's entries type

From: Oliver Fromme <olli_at_lurza.secnetix.de>
Date: Fri, 28 Jul 2006 15:54:40 +0200 (CEST)
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
Received on Fri Jul 28 2006 - 11:54:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC