diff options
-rw-r--r-- | usr/src/uts/i86pc/os/trap.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/usr/src/uts/i86pc/os/trap.c b/usr/src/uts/i86pc/os/trap.c index 7aadc17f4a..c88fec6fbe 100644 --- a/usr/src/uts/i86pc/os/trap.c +++ b/usr/src/uts/i86pc/os/trap.c @@ -1480,12 +1480,23 @@ trap(struct regs *rp, caddr_t addr, processorid_t cpuid) ct->t_sig_check = 0; - mutex_enter(&p->p_lock); + /* + * As in other code paths that check against TP_CHANGEBIND, + * we perform the check first without p_lock held -- only + * acquiring p_lock in the unlikely event that it is indeed + * set. This is safe because we are doing this after the + * astoff(); if we are racing another thread setting + * TP_CHANGEBIND on us, we will pick it up on a subsequent + * lap through. + */ if (curthread->t_proc_flag & TP_CHANGEBIND) { - timer_lwpbind(); - curthread->t_proc_flag &= ~TP_CHANGEBIND; + mutex_enter(&p->p_lock); + if (curthread->t_proc_flag & TP_CHANGEBIND) { + timer_lwpbind(); + curthread->t_proc_flag &= ~TP_CHANGEBIND; + } + mutex_exit(&p->p_lock); } - mutex_exit(&p->p_lock); /* * for kaio requests that are on the per-process poll queue, |