From owner-freebsd-stable@FreeBSD.ORG Sun Jul 6 20:30:27 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E925E37B401 for ; Sun, 6 Jul 2003 20:30:27 -0700 (PDT) Received: from pd3mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1311643FBF for ; Sun, 6 Jul 2003 20:30:27 -0700 (PDT) (envelope-from cpressey@catseye.mb.ca) Received: from pd2mr2so.prod.shaw.ca (pd2mr2so-ser.prod.shaw.ca [10.0.141.109])2003)) with ESMTP id <0HHM00DKWXQQBL@l-daemon> for stable@freebsd.org; Sun, 06 Jul 2003 21:30:26 -0600 (MDT) Received: from pn2ml2so.prod.shaw.ca (pn2ml2so-qfe0.prod.shaw.ca [10.0.121.146]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with ESMTP id <0HHM002LQXQQ2E@l-daemon> for stable@freebsd.org; Sun, 06 Jul 2003 21:30:26 -0600 (MDT) Received: from kallisti.ca (h24-70-180-74.wp.shawcable.net [24.70.180.74]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with SMTP id <0HHM00HDFXQQM0@l-daemon> for stable@freebsd.org; Sun, 06 Jul 2003 21:30:26 -0600 (MDT) Date: Sun, 06 Jul 2003 22:32:06 -0500 From: Chris Pressey In-reply-to: <44u19zxcg4.fsf@be-well.ilk.org> To: stable@freebsd.org Message-id: <20030706223206.09a17f29.cpressey@catseye.mb.ca> Organization: Cat's Eye Technologies - http://www.catseye.mb.ca/ MIME-version: 1.0 X-Mailer: Sylpheed version 0.9.3 (GTK+ 1.2.10; i386-portbld-freebsd4.8) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT References: <200307051728.24681.me@farid-hajji.de> <44brw8g26e.fsf@be-well.ilk.org> <200307060029.00866.me@farid-hajji.de> <3F07576F.4030105@mac.com> <20030706213540.GU430@gsmx07.alcatel.com.au> <20030706215545.1c29c5ed.cpressey@catseye.mb.ca> <44u19zxcg4.fsf@be-well.ilk.org> Subject: Re: Weird vmstat -s stats X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 03:30:28 -0000 On 06 Jul 2003 23:06:35 -0400 Lowell Gilbert wrote: > Chris Pressey writes: > > > 'Scuse me if I'm out of my depth here, but wouldn't the atomic > > 64-bit update only have to be done when the lower 32 bits were about > > to wrap(which would be relatively infrequent)? > > Unfortunately, that doesn't quite work. It opens up a race condition > where the counter wasn't about to wrap when you do the check, but > has been advanced again when you do the increment. > > > The check to see if the lower 32 bits were about to wrap would be > > relatively cheap, too, I'd think. > > Absolutely. The problem is just that the check itself is not atomic. OK, that makes sense. Still, it seems like there are two viable alternatives - 1) use an atomically-updated 32-bit counter, which we know WILL eventually yield an inaccurate result in a forseeable time frame; or 2) use a 64-bit counter of which only the bottom 32 bits are atomically updated, which MAY yield an inaccurate result in the same time frame. Even though it's not 100% guaranteed, the second option does strike me as a small improvement over the first. -Chris