mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	linux-kernel@vger.kernel.org,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 2/3] srcu: queue work without holding the lock
Date: Fri, 22 Sep 2017 17:28:05 +0200	[thread overview]
Message-ID: <20170922152806.22860-2-bigeasy@linutronix.de> (raw)
In-Reply-To: <20170922152806.22860-1-bigeasy@linutronix.de>

On RT we can't invoke queue_delayed_work() within an atomic section
(which is provided by raw_spin_lock_irqsave()).
srcu_reschedule() invokes queue_delayed_work() outside of the
raw_spin_lock_irq_rcu_node() section so this should be fine here, too.
If the remaining callers of call_srcu() aren't atomic
(spin_lock_irqsave() is fine) then this should work on RT, too.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/rcu/srcutree.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index d190af0e56f8..3ee4ef40f23e 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -648,12 +648,17 @@ static void srcu_funnel_gp_start(struct srcu_struct *sp, struct srcu_data *sdp,
 	/* If grace period not already done and none in progress, start it. */
 	if (!rcu_seq_done(&sp->srcu_gp_seq, s) &&
 	    rcu_seq_state(sp->srcu_gp_seq) == SRCU_STATE_IDLE) {
+		unsigned long delay;
+
 		WARN_ON_ONCE(ULONG_CMP_GE(sp->srcu_gp_seq, sp->srcu_gp_seq_needed));
 		srcu_gp_start(sp);
+		delay = srcu_get_delay(sp);
+		raw_spin_unlock_irqrestore_rcu_node(sp, flags);
+
 		queue_delayed_work(system_power_efficient_wq, &sp->work,
-				   srcu_get_delay(sp));
-	}
-	raw_spin_unlock_irqrestore_rcu_node(sp, flags);
+				   delay);
+	} else
+		raw_spin_unlock_irqrestore_rcu_node(sp, flags);
 }
 
 /*
-- 
2.14.1

  reply	other threads:[~2017-09-22 15:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22 15:28 [PATCH 1/3] srcu: use cpu_online() instead custom check Sebastian Andrzej Siewior
2017-09-22 15:28 ` Sebastian Andrzej Siewior [this message]
2017-09-22 18:46   ` [PATCH 2/3] srcu: queue work without holding the lock Paul E. McKenney
2017-09-28 16:03     ` Sebastian Andrzej Siewior
2017-09-29  1:10       ` Paul E. McKenney
2017-10-10 21:43         ` Paul E. McKenney
2017-10-11 16:40           ` Sebastian Andrzej Siewior
2017-10-11 16:46             ` Paul E. McKenney
2017-10-12  8:53           ` Sebastian Andrzej Siewior
2017-10-12 18:24             ` Paul E. McKenney
2017-10-13  7:08               ` Sebastian Andrzej Siewior
2017-09-22 15:28 ` [PATCH 3/3] rcu/segcblist: include rcupdate.h Sebastian Andrzej Siewior
2017-09-22 18:47   ` Paul E. McKenney
2017-09-22 18:43 ` [PATCH 1/3] srcu: use cpu_online() instead custom check Paul E. McKenney
2017-09-28 16:02   ` Sebastian Andrzej Siewior
2017-09-29  1:09     ` 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=20170922152806.22860-2-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®