Re: [tip:locking/core] rtmutex: Deboost before waking up the top waiter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/05/2017 at 04:08 PM, Mike Galbraith wrote:
> locking/rtmutex: Fix preempt leak in __rt_mutex_futex_unlock()
>
> mark_wakeup_next_waiter() already disables preemption, doing so
> again leaves us with an unpaired preempt_disable().

You can also fix the corresponding comment in rt_mutex_postunlock():
    /* Pairs with preempt_disable() in rt_mutex_slowunlock() */
    preempt_enable();

Thanks,
Xunlei

>
> Signed-off-by: Mike Galbraith <efault@xxxxxx>
> ---
>  kernel/locking/rtmutex.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> --- a/kernel/locking/rtmutex.c
> +++ b/kernel/locking/rtmutex.c
> @@ -1581,13 +1581,13 @@ bool __sched __rt_mutex_futex_unlock(str
>  		return false; /* done */
>  	}
>  
> -	mark_wakeup_next_waiter(wake_q, lock);
>  	/*
> -	 * We've already deboosted, retain preempt_disabled when dropping
> -	 * the wait_lock to avoid inversion until the wakeup. Matched
> -	 * by rt_mutex_postunlock();
> +	 * We've already deboosted, mark_wakeup_next_waiter() will
> +	 * retain preempt_disabled when we drop the wait_lock, to
> +	 * avoid inversion prior to the wakeup.  preempt_disable()
> +	 * therein pairs with rt_mutex_postunlock().
>  	 */
> -	preempt_disable();
> +	mark_wakeup_next_waiter(wake_q, lock);
>  
>  	return true; /* call postunlock() */
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux