diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2008-03-19 06:19:01 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2008-03-19 06:19:01 +0000 |
commit | 374ae2a39338777f5f9ef0ed726fff2a5dee6485 (patch) | |
tree | 720fece23c8482c35e341e275a0f4068ee43126f /sys/kern/kern_thread.c | |
parent | b23372cd8ee7abcc1b32caf4cf72d5bd12f7102f (diff) | |
download | src-374ae2a39338777f5f9ef0ed726fff2a5dee6485.tar.gz src-374ae2a39338777f5f9ef0ed726fff2a5dee6485.zip |
- Relax requirements for p_numthreads, p_threads, p_swtick, and p_nice from
requiring the per-process spinlock to only requiring the process lock.
- Reflect these changes in the proc.h documentation and consumers throughout
the kernel. This is a substantial reduction in locking cost for these
fields and was made possible by recent changes to threading support.
Notes
Notes:
svn path=/head/; revision=177368
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r-- | sys/kern/kern_thread.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index ec63f89b78c4..91d8c556dd5b 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -345,9 +345,7 @@ thread_exit(void) #ifdef AUDIT AUDIT_SYSCALL_EXIT(0, td); #endif - umtx_thread_exit(td); - /* * drop FPU & debug register state storage, or any other * architecture specific resources that @@ -374,9 +372,7 @@ thread_exit(void) */ if (p->p_flag & P_HADTHREADS) { if (p->p_numthreads > 1) { - thread_lock(td); thread_unlink(td); - thread_unlock(td); td2 = FIRST_THREAD_IN_PROC(p); sched_exit_thread(td2, td); @@ -450,8 +446,8 @@ thread_link(struct thread *td, struct proc *p) /* * XXX This can't be enabled because it's called for proc0 before - * it's spinlock has been created. - * PROC_SLOCK_ASSERT(p, MA_OWNED); + * its lock has been created. + * PROC_LOCK_ASSERT(p, MA_OWNED); */ td->td_state = TDS_INACTIVE; td->td_proc = p; @@ -487,7 +483,7 @@ thread_unlink(struct thread *td) { struct proc *p = td->td_proc; - PROC_SLOCK_ASSERT(p, MA_OWNED); + PROC_LOCK_ASSERT(p, MA_OWNED); TAILQ_REMOVE(&p->p_threads, td, td_plist); p->p_numthreads--; /* could clear a few other things here */ @@ -863,11 +859,9 @@ thread_find(struct proc *p, lwpid_t tid) struct thread *td; PROC_LOCK_ASSERT(p, MA_OWNED); - PROC_SLOCK(p); FOREACH_THREAD_IN_PROC(p, td) { if (td->td_tid == tid) break; } - PROC_SUNLOCK(p); return (td); } |