rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Uladzislau Rezki <urezki@gmail.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>, RCU <rcu@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Theodore Y . Ts'o" <tytso@mit.edu>,
	Matthew Wilcox <willy@infradead.org>,
	Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>
Subject: Re: [PATCH 1/1] rcu/tree: Drop the lock before entering to page allocator
Date: Thu, 16 Jul 2020 14:27:07 -0400	[thread overview]
Message-ID: <20200716182707.GA552227@google.com> (raw)
In-Reply-To: <20200716143714.GA30965@pc636>

On Thu, Jul 16, 2020 at 04:37:14PM +0200, Uladzislau Rezki wrote:
> On Thu, Jul 16, 2020 at 09:36:47AM -0400, Joel Fernandes wrote:
> > On Thu, Jul 16, 2020 at 11:19:13AM +0200, Uladzislau Rezki wrote:
> > > On Wed, Jul 15, 2020 at 07:13:33PM -0400, Joel Fernandes wrote:
> > > > On Wed, Jul 15, 2020 at 2:56 PM Sebastian Andrzej Siewior
> > > > <bigeasy@linutronix.de> wrote:
> > > > >
> > > > > On 2020-07-15 20:35:37 [+0200], Uladzislau Rezki (Sony) wrote:
> > > > > > @@ -3306,6 +3307,9 @@ kvfree_call_rcu_add_ptr_to_bulk(struct kfree_rcu_cpu *krcp, void *ptr)
> > > > > >                       if (IS_ENABLED(CONFIG_PREEMPT_RT))
> > > > > >                               return false;
> > > > > >
> > > > > > +                     preempt_disable();
> > > > > > +                     krc_this_cpu_unlock(*krcp, *flags);
> > > > >
> > > > > Now you enter memory allocator with disabled preemption. This isn't any
> > > > > better but we don't have a warning for this yet.
> > > > > What happened to the part where I asked for a spinlock_t?
> > > > 
> > > > Ulad,
> > > > Wouldn't the replacing of preempt_disable() with migrate_disable()
> > > > above resolve Sebastian's issue?
> > > >
> > > This for regular kernel only. That means that migrate_disable() is
> > > equal to preempt_disable(). So, no difference.
> > 
> > But this will force preempt_disable() context into the low-level page
> > allocator on -RT kernels which I believe is not what Sebastian wants. The
> > whole reason why the spinlock vs raw-spinlock ordering matters is, because on
> > RT, the spinlock is sleeping. So if you have:
> > 
> > raw_spin_lock(..);
> > spin_lock(..);   <-- can sleep on RT, so Sleep while atomic (SWA) violation.
> > 
> > That's the main reason you are dropping the lock before calling the
> > allocator.
> > 
> No. Please read the commit message of this patch. This is for regular kernel.

Wait, so what is the hesitation to put migrate_disable() here? It is even
further documentation (annotation) that the goal here is to stay on the same
CPU - as you indicated in later emails.

And the documentation aspect is also something Sebastian brought. A plain
preempt_disable() is frowned up if there are alternative API that document
the usage.

> You did a patch:
> 
> <snip>
>    if (IS_ENABLED(CONFIG_PREEMPT_RT))
>        return false;
> <snip>

I know, that's what we're discussing.

So again, why the hatred for migrate_disable() ? :)

thanks,

 - Joel


  reply	other threads:[~2020-07-16 18:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 18:35 [PATCH 1/1] rcu/tree: Drop the lock before entering to page allocator Uladzislau Rezki (Sony)
2020-07-15 18:56 ` Sebastian Andrzej Siewior
2020-07-15 19:02   ` Uladzislau Rezki
2020-07-15 19:32     ` Sebastian Andrzej Siewior
2020-07-15 19:36       ` Uladzislau Rezki
2020-07-15 22:14       ` Paul E. McKenney
2020-07-16 14:14         ` Sebastian Andrzej Siewior
2020-07-16 15:20           ` Paul E. McKenney
2020-07-16 15:36             ` Sebastian Andrzej Siewior
2020-07-16 16:36               ` Paul E. McKenney
2020-07-15 23:13   ` Joel Fernandes
2020-07-16  9:19     ` Uladzislau Rezki
2020-07-16 13:36       ` Joel Fernandes
2020-07-16 14:37         ` Uladzislau Rezki
2020-07-16 18:27           ` Joel Fernandes [this message]
2020-07-16 19:03             ` Uladzislau Rezki
2020-07-16 14:25       ` Sebastian Andrzej Siewior
2020-07-16 14:47         ` Uladzislau Rezki
2020-07-16 15:04           ` Sebastian Andrzej Siewior
2020-07-16 15:34             ` Uladzislau Rezki

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=20200716182707.GA552227@google.com \
    --to=joel@joelfernandes.org \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleksiy.avramchenko@sonymobile.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=urezki@gmail.com \
    --cc=willy@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).