summaryrefslogtreecommitdiffstats
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-12-20 04:40:39 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-12-20 04:40:39 +0000
commit5a984630fa31489671b035bd30308b299b2e2b50 (patch)
tree4b0b515b8835b611b65186836ed5b1502ed713d9 /sys/sys/pcpu.h
parenta2c03bf6cb1ee55d23a34b899999fb7fb95310a3 (diff)
downloadFreeBSD-src-5a984630fa31489671b035bd30308b299b2e2b50.zip
FreeBSD-src-5a984630fa31489671b035bd30308b299b2e2b50.tar.gz
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
Diffstat (limited to 'sys/sys/pcpu.h')
-rw-r--r--sys/sys/pcpu.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index 00a3cac..7f45042 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -74,6 +74,7 @@ struct pcpu {
PCPU_MD_FIELDS;
struct vmmeter pc_cnt; /* VM stats counters */
struct device *pc_device;
+ lwpid_t pc_curtid;
};
SLIST_HEAD(cpuhead, pcpu);
OpenPOWER on IntegriCloud