summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/thread.h
diff options
context:
space:
mode:
authormv143129 <none@none>2008-01-07 18:49:45 -0800
committermv143129 <none@none>2008-01-07 18:49:45 -0800
commit2850d85b7b93f31e578520dc3b3feb24db609c62 (patch)
tree2a1994e9e8b17b58b251e608de8c1a449291ba8f /usr/src/uts/common/sys/thread.h
parentca29f3da510ba7f712a40977b04aeceda9b70b95 (diff)
downloadillumos-joyent-2850d85b7b93f31e578520dc3b3feb24db609c62.tar.gz
6619224 Tick accounting needs to be made scalable
Diffstat (limited to 'usr/src/uts/common/sys/thread.h')
-rw-r--r--usr/src/uts/common/sys/thread.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/usr/src/uts/common/sys/thread.h b/usr/src/uts/common/sys/thread.h
index d545e093b3..7302289ea1 100644
--- a/usr/src/uts/common/sys/thread.h
+++ b/usr/src/uts/common/sys/thread.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -515,10 +515,22 @@ extern struct _kthread t0; /* the scheduler thread */
extern kmutex_t pidlock; /* global process lock */
/*
- * thread_free_lock is used by the clock thread to keep a thread
+ * thread_free_lock is used by the tick accounting thread to keep a thread
* from being freed while it is being examined.
*/
-extern kmutex_t thread_free_lock;
+#define THREAD_FREE_NUM 1024
+#define THREAD_FREE_MASK (THREAD_FREE_NUM - 1)
+#define THREAD_FREE_SHIFT_BITS 5
+#define THREAD_FREE_SHIFT(t) ((uintptr_t)t >> THREAD_FREE_SHIFT_BITS)
+#define THREAD_FREE_HASH(t) (THREAD_FREE_SHIFT(t) & THREAD_FREE_MASK)
+
+typedef struct thread_free_lock {
+ kmutex_t tf_lock;
+ uchar_t tf_pad[64 - sizeof (kmutex_t)];
+} thread_free_lock_t;
+
+extern void thread_free_prevent(kthread_t *);
+extern void thread_free_allow(kthread_t *);
/*
* Routines to change the priority and effective priority