From owner-freebsd-arch Mon Nov 12 4:10:31 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 5DED237B405; Mon, 12 Nov 2001 04:10:26 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id XAA19129; Mon, 12 Nov 2001 23:10:16 +1100 Date: Mon, 12 Nov 2001 23:09:06 +1100 (EST) From: Bruce Evans X-X-Sender: To: Matthew Dillon Cc: Peter Wemm , Robert Watson , Subject: Re: cur{thread/proc}, or not. In-Reply-To: <200111121009.fACA9SI75024@apollo.backplane.com> Message-ID: <20011112221522.E36389-100000@delplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Mon, 12 Nov 2001, Matthew Dillon wrote: > If we stopped trying to be fancy with interrupt scheduling and went > back to the BSDI methodology the kernel code could assume that > %fs doesn't change out from under it and we could *GREATLY* Strictly, that the GDT entry for %fs doesn't change. We could safely assume this already for the !SMP case. > simplify the __PCPU_GET() code to something like this: > > static __inline > struct globaldata * > __globaldata(void) > { > struct globaldata *gd; > > __asm("movl %%fs,%0" : "=r" (gd)); > return(gd); > } > > #define __PCPU_GET(name) (__globaldata()->name) > > Which would allow GCC to generate somewhat better code output > (about 1K less code in the text segment as well) as well as > allow the per-cpu variables to be accessed more normally without > having to macros to GET and SET them. This is essentially a slightly pessimized version of the RELENG_4 code for the SMP case (RELENG_4 avoids going through the pointer in for most per-cpu global accesses). It also helps to declare __globaldata() as __pure2 so that gcc can tell that it always returns the same value. It doesn't quite always return the same value, but I can't think of any cases where a cached value would remain valid long enough to cause problems. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message