Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jul 2006 15:54:40 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        B.Candler@pobox.com (Brian Candler)
Cc:        freebsd-current@freebsd.org
Subject:   Re: vmstat's entries type
Message-ID:  <200607281354.k6SDse78082244@lurza.secnetix.de>
In-Reply-To: <20060728134701.GA45273@uk.tiscali.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607281354.k6SDse78082244>