All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Uladzislau Rezki <urezki@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>, RCU <rcu@vger.kernel.org>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	"Theodore Y . Ts'o" <tytso@mit.edu>,
	Matthew Wilcox <willy@infradead.org>,
	Joel Fernandes <joel@joelfernandes.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 09:36:51 -0700	[thread overview]
Message-ID: <20200716163651.GT9247@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <20200716153638.gfh6dzp2h35ygfaa@linutronix.de>

On Thu, Jul 16, 2020 at 05:36:38PM +0200, Sebastian Andrzej Siewior wrote:
> On 2020-07-16 08:20:27 [-0700], Paul E. McKenney wrote:
> > You lost me on this one.  I am instead concerned that something like this
> > might be needed on short notice:
> > 
> > 	raw_spin_lock(&some_lock);
> > 	kfree_rcu(some_pointer, some_field_offset);
> > 
> > In contrast, single-argument kfree_rcu() cannot be invoked from any
> > environment where synchronize_rcu() cannot be invoked.
> 
> I see. We don't have any kfree() in that context as far as I remember.
> We had a few cases in "resize" where you allocate memory, copy content
> and free old memory while under the lock but they are gone.

True, but we also didn't have any calls to call_rcu() prior to the call
to rcu_init() until suddenly we did.  (Yeah, I could have put my foot
down and prohibited that practice, but the workarounds were quite a bit
more complicated than just making call_rcu() work during very early boot.)

And last I checked, there really were calls to call_rcu() under raw
spinlocks, so the potential or calls to double-argument kfree_rcu()
clearly exists and is very real.

> > > > Yes, dropping to a plain spinlock would be simple in the here and now,
> > > > but experience indicates that it is only a matter of time, and that when
> > > > that time comes it will come as an emergency.
> > > 
> > > Hmmm.
> > 
> > I point out the call_rcu() experience.
> > 
> > > > One approach would be to replace the "IS_ENABLED(CONFIG_PREEMPT_RT)"
> > > > with some sort of check for being in a context where spinlock acquisition
> > > > is not legal.  What could be done along those lines?
> > > 
> > > I would rethink the whole concept how this is implemented now and give
> > > it another try. The code does not look pretty and is looking
> > > complicated. The RT covering of this part then just added a simple
> > > return because nothing else seemed to be possible. This patch here
> > > looks like another duct tape attempt to avoid a warning.
> > 
> > In addition to the possibility of invocation from BH?
> 
> Invocation from BH should be possible because network would probably be
> the first user. I don't remember anything wrong with BH if I remember
> correctly.

OK, that is reassuring.  Here is hoping!

							Thanx, Paul

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

Thread overview: 21+ 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 [this message]
2020-07-15 23:13   ` Joel Fernandes
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
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=20200716163651.GT9247@paulmck-ThinkPad-P72 \
    --to=paulmck@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleksiy.avramchenko@sonymobile.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.