]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add a lwpid field into per-cpu structure, the lwpid represents current
authorDavid Xu <davidxu@FreeBSD.org>
Wed, 20 Dec 2006 04:40:39 +0000 (04:40 +0000)
committerDavid Xu <davidxu@FreeBSD.org>
Wed, 20 Dec 2006 04:40:39 +0000 (04:40 +0000)
commit4e32b7b3cc7d282700ca3df60c5378d57e65ab14
tree4b0b515b8835b611b65186836ed5b1502ed713d9
parentcd1b20d58a5d870b552a5a7e797e58f7b9cb0b69
Add a lwpid field into per-cpu structure, the lwpid represents current
running thread's id on each cpu. This allow us to add in-kernel adaptive
spin for user level mutex. While spinning in user space is possible,
without correct thread running state exported from kernel, it hardly
can be implemented efficiently without wasting cpu cycles, however
exporting thread running state unlikely will be implemented soon as
it has to design and stablize interfaces. This implementation is
transparent to user space, it can be disabled dynamically. With this
change, mutex ping-pong program's performance is improved massively on
SMP machine. performance of mysql super-smack select benchmark is increased
about 7% on Intel dual dual-core2 Xeon machine, it indicates on systems
which have bunch of cpus and system-call overhead is low (athlon64, opteron,
and core-2 are known to be fast), the adaptive spin does help performance.

Added sysctls:
    kern.threads.umtx_dflt_spins
        if the sysctl value is non-zero, a zero umutex.m_spincount will
        cause the sysctl value to be used a spin cycle count.
    kern.threads.umtx_max_spins
        the sysctl sets upper limit of spin cycle count.

Tested on: Athlon64 X2 3800+, Dual Xeon 5130
sys/amd64/amd64/cpu_switch.S
sys/amd64/amd64/genassym.c
sys/amd64/amd64/machdep.c
sys/i386/i386/genassym.c
sys/i386/i386/machdep.c
sys/i386/i386/swtch.s
sys/ia64/ia64/machdep.c
sys/kern/kern_umtx.c
sys/sys/pcpu.h
sys/sys/umtx.h