From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161049AbcIZPfT (ORCPT ); Mon, 26 Sep 2016 11:35:19 -0400 Received: from smtprelay0168.hostedemail.com ([216.40.44.168]:46663 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934254AbcIZPfR (ORCPT ); Mon, 26 Sep 2016 11:35:17 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:5007:6261:7875:8660:10004:10400:10848:10967:11026:11232:11658:11914:12198:12438:12740:12760:13069:13148:13230:13311:13357:13439:14096:14097:14181:14659:14721:21080:21324:30012:30036:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: van49_106efc1d57a55 X-Filterd-Recvd-Size: 2596 Date: Mon, 26 Sep 2016 11:35:03 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: mingo@kernel.org, tglx@linutronix.de, juri.lelli@arm.com, xlpang@redhat.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, jdesfossez@efficios.com, bristot@redhat.com, Ingo Molnar Subject: Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter Message-ID: <20160926113503.7d0528de@grimm.local.home> In-Reply-To: <20160926152228.GE5016@twins.programming.kicks-ass.net> References: <20160926123213.851818224@infradead.org> <20160926124127.863639194@infradead.org> <20160926111511.1d963075@grimm.local.home> <20160926152228.GE5016@twins.programming.kicks-ass.net> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Sep 2016 17:22:28 +0200 Peter Zijlstra wrote: > > > + /* > > > + * We should deboost before waking the top waiter task such that > > > + * we don't run two tasks with the 'same' priority. This however > > > + * can lead to prio-inversion if we would get preempted after > > > + * the deboost but before waking our high-prio task, hence the > > > + * preempt_disable before unlock. Pairs with preempt_enable() in > > > + * rt_mutex_postunlock(); > > > > There's a preempt_enable() in rt_mutex_postunlock()? Does > > wake_futex_pi() know that? > > > > Not sure I see your point. rt_mutex_futex_unlock() calls > rt_mutex_slowunlock() which does the preempt_disable(), we then pass the > return of that into deboost, which we pass into rt_mutex_postunlock() > and everything should be balanced. Can we please add more comments explaining this. Having side effects of functions disabling preemption, passing a bool saying that it did, and needing to call another function (somewhat seemingly unrelated) to re-enable preemption, just seems a bit of a stretch for maintainable code. Especially now that the code after the spin_unlock(&hb->lock) is now a critical section (preemption is disable). There's nothing obvious in futex.c that says it is. Just think about looking at this code in another 5 years. Are you going to remember all this? -- Steve