summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_thread.c14
-rw-r--r--sys/sys/proc.h2
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 89f6137..40652b6 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -981,7 +981,12 @@ void
tidhash_add(struct thread *td)
{
rw_wlock(&tidhash_lock);
- LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash);
+ thread_lock(td);
+ if ((td->td_flags & TDF_TIDHASH) == 0) {
+ LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash);
+ td->td_flags |= TDF_TIDHASH;
+ }
+ thread_unlock(td);
rw_wunlock(&tidhash_lock);
}
@@ -989,6 +994,11 @@ void
tidhash_remove(struct thread *td)
{
rw_wlock(&tidhash_lock);
- LIST_REMOVE(td, td_hash);
+ thread_lock(td);
+ if ((td->td_flags & TDF_TIDHASH) != 0) {
+ LIST_REMOVE(td, td_hash);
+ td->td_flags &= ~TDF_TIDHASH;
+ }
+ thread_unlock(td);
rw_wunlock(&tidhash_lock);
}
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 9bce569..21fc29f 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -353,7 +353,7 @@ do { \
#define TDF_NEEDRESCHED 0x00010000 /* Thread needs to yield. */
#define TDF_NEEDSIGCHK 0x00020000 /* Thread may need signal delivery. */
#define TDF_NOLOAD 0x00040000 /* Ignore during load avg calculations. */
-#define TDF_UNUSED19 0x00080000 /* Thread is sleeping on a umtx. */
+#define TDF_TIDHASH 0x00080000 /* Thread is on hash table. */
#define TDF_THRWAKEUP 0x00100000 /* Libthr thread must not suspend itself. */
#define TDF_UNUSED21 0x00200000 /* --available-- */
#define TDF_SWAPINREQ 0x00400000 /* Swapin request due to wakeup. */
OpenPOWER on IntegriCloud