Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Jan 2002 15:49:20 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Mike Smith <msmith@FreeBSD.ORG>, Bernd Walter <ticso@cicely8.cicely.de>, Michal Mertl <mime@traveller.cz>, <arch@FreeBSD.ORG>
Subject:   Re: When to use atomic_ functions? (was: 64 bit counters) 
Message-ID:  <200201012349.g01NnKA40071@apollo.backplane.com>
References:   <20020102075650.L11121-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

:On Tue, 1 Jan 2002, Mike Smith wrote:
:
:> > MBs are not needed for the variable itself, but they are making this
:> > family of functions very expensive.
:> > It's not very wise to handle counters with atomic_ functions unless
:> > the need to have MBs in them is not removed.
:>
:> It's imperative to use atomic operations for counters on SMP systems.
:
:Not true.  Atomic operations for counters are not needed on SMP systems
:in at least the following cases:
:- if there is a lock that prevents other processes from accessing the
:  counter
:- if the counters are per-CPU.  See previous mail by someone named msmith.
:
:Bruce

    Well, I'm not sure how I got on the Cc list but I agree with Bruce
    on this one.   An SMP-synchronized counter increment is a ridiculous
    waste of time.  They should be per-cpu and then we don't care *how* 
    wide the counters are.  Having programs like netstat, or our sysctl
    mechanism, aggregate the count values is easy.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>

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?200201012349.g01NnKA40071>