Skip site navigation (1)Skip section navigation (2)
Date:      06 Jul 2003 23:06:35 -0400
From:      Lowell Gilbert <freebsd-stable-local@be-well.no-ip.com>
To:        stable@freebsd.org
Subject:   Re: Weird vmstat -s stats
Message-ID:  <44u19zxcg4.fsf@be-well.ilk.org>
In-Reply-To: <20030706215545.1c29c5ed.cpressey@catseye.mb.ca>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
Chris Pressey <cpressey@catseye.mb.ca> 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.



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