Subject: Re: CVS commit: [sommerfeld_i386mp_1] syssrc/sys/arch/i386
To: Andrew Doran <ad@interlude.eu.org>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: tech-smp
Date: 12/30/2001 12:59:44
> > Set up per-cpu GDT.
> > Use %fs for per-cpu data access.
> 
> Why? Just curious, feel free to ignore.

Performance.  The kernel makes very frequent access to per-cpu data
like curproc.  

Before this change, we used the on-chip APIC's cpu-id register, but
accesses to it turn out to be surprisingly slow.

Putting a per-cpu pointer into a fixed general register is the normal
way to do this (on processors which have enough registers); intel
is.. extremely short on registers -- but our ABI pretty much doesn't
use %fs and %gs at all, and they can be used as base registers.

					- Bill