summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_threads.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-10-20 07:26:37 +0000
committerjhb <jhb@FreeBSD.org>2000-10-20 07:26:37 +0000
commitf671832d7667351a66ab594f63d8cd4ef66e8e91 (patch)
tree99efa7c13c407257b68406e364261eeb1b2c1972 /sys/kern/kern_threads.c
parent787712af1c7ffb2642f8250f2111301ad77fdaf8 (diff)
downloadFreeBSD-src-f671832d7667351a66ab594f63d8cd4ef66e8e91.zip
FreeBSD-src-f671832d7667351a66ab594f63d8cd4ef66e8e91.tar.gz
- Make the mutex code almost completely machine independent. This greatly
reducues the maintenance load for the mutex code. The only MD portions of the mutex code are in machine/mutex.h now, which include the assembly macros for handling mutexes as well as optionally overriding the mutex micro-operations. For example, we use optimized micro-ops on the x86 platform #ifndef I386_CPU. - Change the behavior of the SMP_DEBUG kernel option. In the new code, mtx_assert() only depends on INVARIANTS, allowing other kernel developers to have working mutex assertiions without having to include all of the mutex debugging code. The SMP_DEBUG kernel option has been renamed to MUTEX_DEBUG and now just controls extra mutex debugging code. - Abolish the ugly mtx_f hack. Instead, we dynamically allocate seperate mtx_debug structures on the fly in mtx_init, except for mutexes that are initiated very early in the boot process. These mutexes are declared using a special MUTEX_DECLARE() macro, and use a new flag MTX_COLD when calling mtx_init. This is still somewhat hackish, but it is less evil than the mtx_f filler struct, and the mtx struct is now the same size with and without mutex debugging code. - Add some micro-micro-operation macros for doing the actual atomic operations on the mutex mtx_lock field to make it easier for other archs to override/optimize mutex ops if needed. These new tiny ops also clean up the code in some places by replacing long atomic operation function calls that spanned 2-3 lines with a short 1-line macro call. - Don't call mi_switch() from mtx_enter_hard() when we block while trying to obtain a sleep mutex. Calling mi_switch() would bogusly release Giant before switching to the next process. Instead, inline most of the code from mi_switch() in the mtx_enter_hard() function. Note that when we finally kill Giant we can back this out and go back to calling mi_switch().
Diffstat (limited to 'sys/kern/kern_threads.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud