diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 90df2fc..e595684 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -181,7 +181,7 @@ lockmgr_xholder(struct lock *lk) */ static __inline int sleeplk(struct lock *lk, u_int flags, struct lock_object *ilk, - const char *wmesg, int pri, int timo, int queue) + const char *wmesg, int pri, int timo, int queue, int *wakeup_swapper) { GIANT_DECLARE; struct lock_class *class; @@ -215,8 +215,14 @@ sleeplk(struct lock *lk, u_int flags, struct lock_object *ilk, else sleepq_wait(&lk->lock_object, pri); GIANT_RESTORE(); - if ((flags & LK_SLEEPFAIL) && error == 0) + if ((flags & LK_SLEEPFAIL) && error == 0) { error = ENOLCK; + queue = 1 - queue; + sleepq_lock(&lk->lock_object); + *wakeup_swapper |= sleepq_broadcast(&lk->lock_object, SLEEPQ_LK, + 0, queue); + sleepq_release(&lk->lock_object); + } return (error); } @@ -576,7 +582,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk, * we will sleep. */ error = sleeplk(lk, flags, ilk, iwmesg, ipri, itimo, - SQ_SHARED_QUEUE); + SQ_SHARED_QUEUE, &wakeup_swapper); flags &= ~LK_INTERLOCK; if (error) { LOCK_LOG3(lk, @@ -819,7 +825,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk, * is set, we will sleep. */ error = sleeplk(lk, flags, ilk, iwmesg, ipri, itimo, - SQ_EXCLUSIVE_QUEUE); + SQ_EXCLUSIVE_QUEUE, &wakeup_swapper); flags &= ~LK_INTERLOCK; if (error) { LOCK_LOG3(lk,