From owner-freebsd-arch Wed Jan 2 16: 2:18 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 A681537B41A; Wed, 2 Jan 2002 16:02:15 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g0302Eo60575; Wed, 2 Jan 2002 16:02:14 -0800 (PST) (envelope-from dillon) Date: Wed, 2 Jan 2002 16:02:14 -0800 (PST) From: Matthew Dillon Message-Id: <200201030002.g0302Eo60575@apollo.backplane.com> To: John Baldwin Cc: arch@FreeBSD.ORG, Bernd Walter , Mike Smith , Bruce Evans , Michal Mertl , Peter Jeremy Subject: Re: When to use atomic_ functions? (was: 64 bit counters) References: 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 :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? -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message