From owner-freebsd-arch Wed Jan 2 16: 7:42 2002 Delivered-To: freebsd-arch@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 0A24E37B41C; Wed, 2 Jan 2002 16:07:40 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id 7958C81D03; Wed, 2 Jan 2002 18:07:34 -0600 (CST) Date: Wed, 2 Jan 2002 18:07:34 -0600 From: Alfred Perlstein To: Matthew Dillon Cc: John Baldwin , arch@FreeBSD.ORG, Bernd Walter , Mike Smith , Bruce Evans , Michal Mertl , Peter Jeremy Subject: Re: When to use atomic_ functions? (was: 64 bit counters) Message-ID: <20020102180734.A82406@elvis.mu.org> References: <200201030002.g0302Eo60575@apollo.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200201030002.g0302Eo60575@apollo.backplane.com>; from dillon@apollo.backplane.com on Wed, Jan 02, 2002 at 04:02:14PM -0800 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 * Matthew Dillon [020102 18:02] wrote: > :Look at PCPU_GET/PCPU_SET. Note that since an interrupt can preempt you and > :push you off onto another CPU, you have to use a critical section while > :updating per-CPU variables. If desired, some kind of free area could be stuck > :in struct pcpu (or more likely, struct pcpu would hold a pointer to the area) > :that could be galloc/gfree'd or some such. > : > :-- > : > :John Baldwin <>< http://www.FreeBSD.org/~jhb/ > :"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ > > Maybe we are going about this all wrong. If a particular interface > counter can only be modified from the device interrupt, or only be > modified while holding the appropriate mutex, do we need any locking > at all? Yes against the collector unless the collector is run periodically on each cpu to collect the stats. -- -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