linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: joel@joelfernandes.org
Cc: Uladzislau Rezki <urezki@gmail.com>,
	linux-kernel@vger.kernel.org,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Josh Triplett <josh@joshtriplett.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	rcu@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH rcu/dev -fixes 2/4] rcu/tree: Skip entry into the page allocator for PREEMPT_RT
Date: Wed, 22 Apr 2020 06:28:53 -0700	[thread overview]
Message-ID: <20200422132853.GM17661@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <51A69C78-FDD4-4A15-8969-EEA17CBA5BBD@joelfernandes.org>

On Wed, Apr 22, 2020 at 09:18:41AM -0400, joel@joelfernandes.org wrote:
> 
> 
> On April 22, 2020 6:35:36 AM EDT, Uladzislau Rezki <urezki@gmail.com> wrote:
> >On Mon, Apr 20, 2020 at 11:38:35AM -0400, Joel Fernandes (Google)
> >wrote:
> >> To keep kfree_rcu() path working on raw non-preemptible sections,
> >> prevent the optional entry into the allocator as it uses sleeping
> >locks.
> >> In fact, even if the caller of kfree_rcu() is preemptible, this path
> >> still is not, as krcp->lock is a raw spinlock as done in previous
> >> patches. With additional page pre-allocation in the works, hitting
> >this
> >> return is going to be much less likely soon so just prevent it for
> >now
> >> so that PREEMPT_RT does not break. Note that page allocation here is
> >an
> >> optimization and skipping it still makes kfree_rcu() work.
> >> 
> >> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> >> Co-developed-by: Uladzislau Rezki <urezki@gmail.com>
> >> Signed-off-by: Uladzislau Rezki <urezki@gmail.com>
> >> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> >> ---
> >>  kernel/rcu/tree.c | 12 ++++++++++++
> >>  1 file changed, 12 insertions(+)
> >> 
> >> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> >> index cf68d3d9f5b81..cd61649e1b001 100644
> >> --- a/kernel/rcu/tree.c
> >> +++ b/kernel/rcu/tree.c
> >> @@ -3092,6 +3092,18 @@ kfree_call_rcu_add_ptr_to_bulk(struct
> >kfree_rcu_cpu *krcp,
> >>  		if (!bnode) {
> >>  			WARN_ON_ONCE(sizeof(struct kfree_rcu_bulk_data) > PAGE_SIZE);
> >>  
> >> +			/*
> >> +			 * To keep this path working on raw non-preemptible
> >> +			 * sections, prevent the optional entry into the
> >> +			 * allocator as it uses sleeping locks. In fact, even
> >> +			 * if the caller of kfree_rcu() is preemptible, this
> >> +			 * path still is not, as krcp->lock is a raw spinlock.
> >> +			 * With additional page pre-allocation in the works,
> >> +			 * hitting this return is going to be much less likely.
> >> +			 */
> >> +			if (IS_ENABLED(CONFIG_PREEMPT_RT))
> >> +				return false;
> >> +
> >>  			bnode = (struct kfree_rcu_bulk_data *)
> >>  				__get_free_page(GFP_NOWAIT | __GFP_NOWARN);
> >>  		}
> >This will not be correctly working by just reverting everything to the
> >"rcu_head path" for CONFIG_PREEMPT_RT kernel. We need to preallocate at
> >least once. I can add caching on top of this series to address it.
> 
> I discussed with Vlad offline, this patch is fine for mainline as we
> don't have headless support yet. So this patch is good. Future patches
> adding caching will also add the headless support after additional
> caching, so skipping the allocation here is ok.

Sounds good!

But would one of the realtime guys be willing to give a Tested-by?

							Thanx, Paul

> Thanks.
> 
> - Joel
> 
> 
> 
> 
> >--
> >Vlad Rezki
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.

  reply	other threads:[~2020-04-22 13:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 15:38 [PATCH rcu/dev -fixes 0/4] Joel Fernandes (Google)
2020-04-20 15:38 ` [PATCH rcu/dev -fixes 1/4] rcu/tree: Keep kfree_rcu() awake during lock contention Joel Fernandes (Google)
2020-04-21 13:12   ` Uladzislau Rezki
2020-04-20 15:38 ` [PATCH rcu/dev -fixes 2/4] rcu/tree: Skip entry into the page allocator for PREEMPT_RT Joel Fernandes (Google)
2020-04-22 10:35   ` Uladzislau Rezki
2020-04-22 11:45     ` Uladzislau Rezki
2020-04-22 13:18     ` joel
2020-04-22 13:28       ` Paul E. McKenney [this message]
2020-04-20 15:38 ` [PATCH rcu/dev -fixes 3/4] rcu/tree: Avoid using xchg() in kfree_call_rcu_add_ptr_to_bulk() Joel Fernandes (Google)
2020-04-20 17:18   ` Uladzislau Rezki
2020-04-20 18:19     ` Joel Fernandes
2020-04-20 15:38 ` [PATCH rcu/dev -fixes 4/4] rcu/tree: Use consistent style for comments Joel Fernandes (Google)
2020-04-21 13:08   ` 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=20200422132853.GM17661@paulmck-ThinkPad-P72 \
    --to=paulmck@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=urezki@gmail.com \
    /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).