cvs commit: src/sys/amd64/amd64 cpu_switch.S machdep.c
John Baldwin
jhb at freebsd.org
Tue Oct 18 08:50:47 PDT 2005
On Tuesday 18 October 2005 09:44 am, Andrew Gallatin wrote:
> David Xu [davidxu at FreeBSD.org] wrote:
> > davidxu 2005-10-17 23:10:31 UTC
> >
> > FreeBSD src repository
> >
> > Modified files:
> > sys/amd64/amd64 cpu_switch.S machdep.c
> > Log:
> > Micro optimization for context switch. Eliminate code for saving
> > gs.base and fs.base. We always update pcb.pcb_gsbase and pcb.pcb_fsbase
> > when user wants to set them, in context switch routine, we only need to
> > write them into registers, we never have to read them out from registers
> > when thread is switched away. Since rdmsr is a serialization instruction,
> > micro benchmark shows it is worthy to do.
>
> Nice. This reduces lmbench context switch latency by about 0.4us (7.2
> -> 6.8us), and reduces TCP loopback latency by about 0.9us (36.1 ->
> 35.2) on my dual core 3800+
>
> It is a shame we can't find a way to use the TSC as a timecounter on
> SMP systems. It seems that about 40% of the context switch time is
> spent just waiting for the PIO read of the ACPI-fast or i8254 to
> return.
You can try it by just setting the kern.timecounter.smp_tsc=1 tunable on boot.
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the cvs-src
mailing list