MP Implmentation 4/4: Final cleanup for this stage. Deal with a race
authorMatthew Dillon <dillon@dragonflybsd.org>
Fri, 11 Jul 2003 17:42:11 +0000 (17:42 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Fri, 11 Jul 2003 17:42:11 +0000 (17:42 +0000)
commitd9eea1a5e4f207878f33647f9d5274ecca8b75c5
treefb4c59dc7381915d7ef5dd3e0f9c01f68759c419
parentcb973d1510c62c9b0a2e26530585a2c50672efa3
MP Implmentation 4/4: Final cleanup for this stage.  Deal with a race
that occurs due to not having to hold the MP lock through an lwkt_switch()
where another cpu may pull off a process from the userland scheduler and
schedule its thread before the original cpu has completely switched out it.
Oddly enough latencies were enough that this bug never caused a crash!

Cleanup the scheduling code and in particular the switch assembly code, save
and restore eflags (cli/sti state) when switching heavy weight processes
(this is already done for light weight threads), add some counters, and
optimize fork() to (statistically) stay on the current cpu for a short while
to take advantage of locality of cache reference, which greatly improves
fork/exec times.  Note that synchronous pipe operations between two procseses
already (statistically) stick to the same cpu (which is what we want).
25 files changed:
sys/i386/apic/mpapic.c
sys/i386/i386/exception.s
sys/i386/i386/genassym.c
sys/i386/i386/machdep.c
sys/i386/i386/mpapic.c
sys/i386/i386/mpboot.s
sys/i386/i386/swtch.s
sys/i386/i386/trap.c
sys/i386/i386/vm_machdep.c
sys/kern/kern_exit.c
sys/kern/kern_switch.c
sys/kern/kern_synch.c
sys/kern/lwkt_thread.c
sys/platform/pc32/apic/mpapic.c
sys/platform/pc32/i386/exception.s
sys/platform/pc32/i386/genassym.c
sys/platform/pc32/i386/machdep.c
sys/platform/pc32/i386/mpapic.c
sys/platform/pc32/i386/mpboot.s
sys/platform/pc32/i386/swtch.s
sys/platform/pc32/i386/trap.c
sys/platform/pc32/i386/vm_machdep.c
sys/platform/vkernel/i386/genassym.c
sys/sys/proc.h
sys/sys/thread.h