From owner-freebsd-arch Tue Jan 1 15:49:29 2002 Delivered-To: freebsd-arch@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 99E3E37B42A; Tue, 1 Jan 2002 15:49:27 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g01NnKA40071; Tue, 1 Jan 2002 15:49:20 -0800 (PST) (envelope-from dillon) Date: Tue, 1 Jan 2002 15:49:20 -0800 (PST) From: Matthew Dillon Message-Id: <200201012349.g01NnKA40071@apollo.backplane.com> To: Bruce Evans Cc: Mike Smith , Bernd Walter , Michal Mertl , Subject: Re: When to use atomic_ functions? (was: 64 bit counters) References: <20020102075650.L11121-100000@gamplex.bde.org> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message