From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933022AbdDFGPc (ORCPT ); Thu, 6 Apr 2017 02:15:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54194 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755013AbdDFGPX (ORCPT ); Thu, 6 Apr 2017 02:15:23 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4647E31F3E4 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=xpang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4647E31F3E4 Reply-To: xlpang@redhat.com Subject: Re: [tip:locking/core] rtmutex: Deboost before waking up the top waiter References: <20170323150216.110065320@infradead.org> <1491379707.6538.2.camel@gmx.de> To: Mike Galbraith , linux-tip-commits@vger.kernel.org Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mingo@kernel.org, xlpang@redhat.com, tglx@linutronix.de, Peter Zijlstra From: Xunlei Pang Message-ID: <58E5DD2F.7040401@redhat.com> Date: Thu, 6 Apr 2017 14:16:15 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1491379707.6538.2.camel@gmx.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 06 Apr 2017 06:15:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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() */ > }