linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: lock_task_sighand() && rcu_boost()
Date: Mon, 5 May 2014 15:26:59 +0200	[thread overview]
Message-ID: <20140505132659.GA17996@redhat.com> (raw)
In-Reply-To: <20140504223804.GF8754@linux.vnet.ibm.com>

On 05/04, Paul E. McKenney wrote:
>
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -884,6 +884,27 @@ static inline void rcu_read_lock(void)
>  /**
>   * rcu_read_unlock() - marks the end of an RCU read-side critical section.
>   *
> + * In most situations, rcu_read_unlock() is immune from deadlock.
> + * However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
> + * is responsible for deboosting, which it does via rt_mutex_unlock().
> + * However, this function acquires the scheduler's runqueue and
> + * priority-inheritance spinlocks.  Thus, deadlock could result if the
> + * caller of rcu_read_unlock() already held one of these locks or any lock
> + * acquired while holding them.
> + *
> + * That said, RCU readers are never priority boosted unless they were
> + * preempted.  Therefore, one way to avoid deadlock is to make sure
> + * that preemption never happens within any RCU read-side critical
> + * section whose outermost rcu_read_unlock() is called with one of
> + * rt_mutex_unlock()'s locks held.
> + *
> + * Given that the set of locks acquired by rt_mutex_unlock() might change
> + * at any time, a somewhat more future-proofed approach is to make sure that
> + * that preemption never happens within any RCU read-side critical
> + * section whose outermost rcu_read_unlock() is called with one of
> + * irqs disabled.  This approach relies on the fact that rt_mutex_unlock()
> + * currently only acquires irq-disabled locks.
> + *
>   * See rcu_read_lock() for more information.
>   */
>  static inline void rcu_read_unlock(void)

Great! And I agree with "might change at any time" part.

I'll update lock_task_sighand() after you push this change (or please feel
free to do this yourself). Cleanup is not that important, of course, but a
short comment referring the documentation above can help another reader to
understand the "unnecessary" local_irq_save/preempt_disable calls.

Thanks Paul.

Oleg.


  reply	other threads:[~2014-05-05 13:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-03 16:11 lock_task_sighand() && rcu_boost() Oleg Nesterov
2014-05-04 18:01 ` Paul E. McKenney
2014-05-04 19:17   ` Oleg Nesterov
2014-05-04 22:38     ` Paul E. McKenney
2014-05-05 13:26       ` Oleg Nesterov [this message]
2014-05-05 15:26         ` Paul E. McKenney
2014-05-05 16:47           ` Oleg Nesterov
2014-05-05 18:53             ` [PATCH] signal: Simplify __lock_task_sighand() Oleg Nesterov
2014-05-05 19:55               ` Oleg Nesterov
2014-05-05 20:56               ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140505132659.GA17996@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).