[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160926153959.GG5016@twins.programming.kicks-ass.net>
Date: Mon, 26 Sep 2016 17:39:59 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: mingo@...nel.org, tglx@...utronix.de, juri.lelli@....com,
xlpang@...hat.com, bigeasy@...utronix.de,
linux-kernel@...r.kernel.org, mathieu.desnoyers@...icios.com,
jdesfossez@...icios.com, bristot@...hat.com,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter
On Mon, Sep 26, 2016 at 11:35:03AM -0400, Steven Rostedt wrote:
> On Mon, 26 Sep 2016 17:22:28 +0200
> Peter Zijlstra <peterz@...radead.org> 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?
There's some cleanups later in the series that should clear this up.
Powered by blists - more mailing lists