summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_private.h
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-11-29 14:22:29 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-11-29 14:22:29 +0000
commit2cc3179bff30b557c1e7aa6ae05b785a6a6ea541 (patch)
tree4a32c5e1d4d462b62323406ce2e8a4f54b00fc1b /lib/libpthread/thread/thr_private.h
parente9f088c4690b0c842d1bca9a0dabf69d914a8c36 (diff)
downloadFreeBSD-src-2cc3179bff30b557c1e7aa6ae05b785a6a6ea541.zip
FreeBSD-src-2cc3179bff30b557c1e7aa6ae05b785a6a6ea541.tar.gz
1.Macro optimizing KSE_LOCK_ACQUIRE and THR_LOCK_ACQUIRE to use static fall
through branch predict as suggested in INTEL IA32 optimization guide. 2.Allocate siginfo arrary separately to avoid pthread to be allocated at 2K boundary, which hits L1 address alias problem and causes context switch to be slow down. 3.Simplify context switch code by removing redundant code, code size is reduced, so it is expected to run faster. Reviewed by: deischen Approved by: re (scottl)
Diffstat (limited to 'lib/libpthread/thread/thr_private.h')
-rw-r--r--lib/libpthread/thread/thr_private.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h
index d8453ff..fc5f97e 100644
--- a/lib/libpthread/thread/thr_private.h
+++ b/lib/libpthread/thread/thr_private.h
@@ -244,13 +244,13 @@ do { \
*/
#define KSE_LOCK_ACQUIRE(kse, lck) \
do { \
- if ((kse)->k_locklevel >= MAX_KSE_LOCKLEVEL) \
- PANIC("Exceeded maximum lock level"); \
- else { \
+ if ((kse)->k_locklevel < MAX_KSE_LOCKLEVEL) { \
(kse)->k_locklevel++; \
_lock_acquire((lck), \
&(kse)->k_lockusers[(kse)->k_locklevel - 1], 0); \
} \
+ else \
+ PANIC("Exceeded maximum lock level"); \
} while (0)
#define KSE_LOCK_RELEASE(kse, lck) \
@@ -665,7 +665,7 @@ struct pthread {
* Used for tracking delivery of signal handlers.
*/
struct pthread_sigframe *curframe;
- siginfo_t siginfo[_SIG_MAXSIG];
+ siginfo_t *siginfo;
/*
* Cancelability flags - the lower 2 bits are used by cancel
@@ -846,15 +846,14 @@ do { \
#define THR_LOCK_ACQUIRE(thrd, lck) \
do { \
- if ((thrd)->locklevel >= MAX_THR_LOCKLEVEL) \
- PANIC("Exceeded maximum lock level"); \
- else { \
+ if ((thrd)->locklevel < MAX_THR_LOCKLEVEL) { \
THR_DEACTIVATE_LAST_LOCK(thrd); \
(thrd)->locklevel++; \
_lock_acquire((lck), \
&(thrd)->lockusers[(thrd)->locklevel - 1], \
(thrd)->active_priority); \
- } \
+ } else \
+ PANIC("Exceeded maximum lock level"); \
} while (0)
#define THR_LOCK_RELEASE(thrd, lck) \
OpenPOWER on IntegriCloud