Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Dec 2001 13:59:02 -0600
From:      Alfred Perlstein <bright@mu.org>
To:        Mike Smith <msmith@freebsd.org>
Cc:        Michal Mertl <mime@traveller.cz>, John Hanley <jh_@yahoo.com>, arch@freebsd.org
Subject:   Re: 64 bit counters
Message-ID:  <20011226135902.O91594@elvis.mu.org>
In-Reply-To: <200112261947.fBQJliM01092@mass.dis.org>; from msmith@freebsd.org on Wed, Dec 26, 2001 at 11:47:44AM -0800
References:  <Pine.BSF.4.41.0112261654060.20665-100000@prg.traveller.cz> <200112261947.fBQJliM01092@mass.dis.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* Mike Smith <msmith@freebsd.org> [011226 13:40] wrote:
> > On Tue, 25 Dec 2001, John Hanley wrote:
> > 
> > Well I didn't think of that but I believe it shouldn't be that much a
> > problem. At most the counter could become wrong :-).
> 
> This would be completely unacceptable.

Agreed.

A lot of people think that a small window where data is inconsistant
and exposed to other subsystems is acceptable.  This is far from
the truth, if a decision is made based on an incorrect counter or
that incorrect counter value is then used in some critical function
the entire system will obviously misbehave.

This can have widespread and dire consequences.  So it's not
acceptable in the general case.

One solution is to implement it correctly then add a knob to
turn off the syncronization for those that want speed over
correctness.  They can poison their data if they so desire.

sysctl kern.hardstats=1

stats_mtx_aquired = 0;
if (hardstats) {
   mtx_lock(&stats_mtx);
   stats_mtx_aquired = 1;
}
update_stats();
if (stats_mtx_aquired) {
   mtx_unlock(&stats_mtx);
}

-- 
-Alfred Perlstein [alfred@freebsd.org]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
Tax deductable donations for FreeBSD: http://www.freebsdfoundation.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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