From owner-freebsd-current@FreeBSD.ORG Fri Jul 28 13:54:49 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0BBE216A4E2; Fri, 28 Jul 2006 13:54:49 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 53DFC43D49; Fri, 28 Jul 2006 13:54:47 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unefez@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k6SDseMo082246; Fri, 28 Jul 2006 15:54:46 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k6SDse78082244; Fri, 28 Jul 2006 15:54:40 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <200607281354.k6SDse78082244@lurza.secnetix.de> To: B.Candler@pobox.com (Brian Candler) Date: Fri, 28 Jul 2006 15:54:40 +0200 (CEST) In-Reply-To: <20060728134701.GA45273@uk.tiscali.com> X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 28 Jul 2006 15:54:46 +0200 (CEST) X-Mailman-Approved-At: Fri, 28 Jul 2006 14:32:11 +0000 Cc: freebsd-current@freebsd.org Subject: Re: vmstat's entries type X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2006 13:54:49 -0000 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