Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2002 12:07:40 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Peter Jeremy <peter.jeremy@alcatel.com.au>
Cc:        John Baldwin <jhb@FreeBSD.org>, arch@FreeBSD.org, Thomas Hurst <tom.hurst@clara.net>, "James E. Housley" <jeh@FreeBSD.org>, Bosko Milekic <bmilekic@technokratis.com>, Michal Mertl <mime@traveller.cz>
Subject:   Re: 64 bit counters again
Message-ID:  <3C45DD8C.E3C3414E@mindspring.com>
References:  <20020116120611.A72285@gsmx07.alcatel.com.au> <XFMail.020115172137.jhb@FreeBSD.org> <20020116161251.E72285@gsmx07.alcatel.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Jeremy wrote:
> I think I'll retract my suggestion that it's possible to read the
> counters on any CPU without locking :-).
> 
> Locking per-CPU counters defeats most of the justification for having
> per-CPU counters in the first place.  (There is still some advantage -
> the counters hopefully stay in the local CPU cache instead of
> continually jumping between caches).

This shouldn't be a problem, if the global total counter is a
real total and not an incremental total, since reading these
values is not a problem, only writing them, even if your
cache coherency is only MEI, instead of MESI.

Statistics are only ever snapshots, anyway.

> How about the following:  Have a per-CPU thread to read the per-CPU
> counters and update them into common counters.  This could be done either
> by having the counter read operation schedule a read on each CPU and
> then returning the total, or having a "counter update" thread that runs
> in each CPU every (say) second [with a degree of time skew] and
> does locked updates into a common central counter.

Complicated; I think the cure is worse than the disease; I'm
still very fond (if one *must* have 64 bit counters) of letting
people build kernels with 64 bit counters on 32 bit processors,
but leaving them 32 bit by default on those platforms.

-- Terry

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?3C45DD8C.E3C3414E>