Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1491375

Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter
Date 2016-09-26 17:50 +0200
Message-ID <slGkh-5BO-1@gated-at.bofh.it> (permalink)
References <slDw5-3SS-3@gated-at.bofh.it> <slDw5-3SS-1@gated-at.bofh.it> <slFRg-5rZ-29@gated-at.bofh.it> <slG0W-5v6-11@gated-at.bofh.it> <slGaC-5yk-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@infradead.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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter Peter Zijlstra <peterz@infradead.org> - 2016-09-26 14:50 +0200
  Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top  waiter Steven Rostedt <rostedt@goodmis.org> - 2016-09-26 17:20 +0200
    Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter Peter Zijlstra <peterz@infradead.org> - 2016-09-26 17:30 +0200
      Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top  waiter Steven Rostedt <rostedt@goodmis.org> - 2016-09-26 17:40 +0200
        Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top  waiter Steven Rostedt <rostedt@goodmis.org> - 2016-09-26 17:40 +0200
          Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter Peter Zijlstra <peterz@infradead.org> - 2016-09-26 17:50 +0200
            Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top  waiter Thomas Gleixner <tglx@linutronix.de> - 2016-09-29 16:50 +0200
              Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter Peter Zijlstra <peterz@infradead.org> - 2016-09-29 17:00 +0200
        Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter Peter Zijlstra <peterz@infradead.org> - 2016-09-26 17:50 +0200
  Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter Peter Zijlstra <peterz@infradead.org> - 2016-09-28 11:30 +0200
  Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top waiter Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-28 11:40 +0200

csiph-web