Date: Mon, 12 Nov 2001 23:09:06 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Matthew Dillon <dillon@apollo.backplane.com> Cc: Peter Wemm <peter@wemm.org>, Robert Watson <rwatson@FreeBSD.ORG>, <freebsd-arch@FreeBSD.ORG> Subject: Re: cur{thread/proc}, or not. Message-ID: <20011112221522.E36389-100000@delplex.bde.org> In-Reply-To: <200111121009.fACA9SI75024@apollo.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011112221522.E36389-100000>