rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: paulmck@kernel.org
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
	mingo@kernel.org, jiangshanlai@gmail.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
	kent.overstreet@gmail.com,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: [PATCH v2 tip/core/rcu 2/6] srcu: Provide internal interface to start a Tiny SRCU grace period
Date: Fri, 20 Nov 2020 16:59:15 -0800	[thread overview]
Message-ID: <20201121005919.17152-2-paulmck@kernel.org> (raw)
In-Reply-To: <@@@>

From: "Paul E. McKenney" <paulmck@kernel.org>

There is a need for a polling interface for SRCU grace periods.
This polling needs to initiate an SRCU grace period without
having to queue (and manage) a callback.  This commit therefore
splits the Tiny SRCU call_srcu() function into callback-queuing and
start-grace-period portions, with the latter in a new function named
srcu_gp_start_if_needed().

Link: https://lore.kernel.org/rcu/20201112201547.GF3365678@moria.home.lan/
Reported-by: Kent Overstreet <kent.overstreet@gmail.com>
Reviewed-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/srcutiny.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c
index 5598cf6..3bac1db 100644
--- a/kernel/rcu/srcutiny.c
+++ b/kernel/rcu/srcutiny.c
@@ -152,6 +152,16 @@ void srcu_drive_gp(struct work_struct *wp)
 }
 EXPORT_SYMBOL_GPL(srcu_drive_gp);
 
+static void srcu_gp_start_if_needed(struct srcu_struct *ssp)
+{
+	if (!READ_ONCE(ssp->srcu_gp_running)) {
+		if (likely(srcu_init_done))
+			schedule_work(&ssp->srcu_work);
+		else if (list_empty(&ssp->srcu_work.entry))
+			list_add(&ssp->srcu_work.entry, &srcu_boot_list);
+	}
+}
+
 /*
  * Enqueue an SRCU callback on the specified srcu_struct structure,
  * initiating grace-period processing if it is not already running.
@@ -167,12 +177,7 @@ void call_srcu(struct srcu_struct *ssp, struct rcu_head *rhp,
 	*ssp->srcu_cb_tail = rhp;
 	ssp->srcu_cb_tail = &rhp->next;
 	local_irq_restore(flags);
-	if (!READ_ONCE(ssp->srcu_gp_running)) {
-		if (likely(srcu_init_done))
-			schedule_work(&ssp->srcu_work);
-		else if (list_empty(&ssp->srcu_work.entry))
-			list_add(&ssp->srcu_work.entry, &srcu_boot_list);
-	}
+	srcu_gp_start_if_needed(ssp);
 }
 EXPORT_SYMBOL_GPL(call_srcu);
 
-- 
2.9.5


  parent reply	other threads:[~2020-11-21  0:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <@@@>
2020-02-14 23:38 ` [PATCH tip/core/rcu 1/9] doc: Add some more RCU list patterns in the kernel paulmck
2020-02-14 23:38 ` [PATCH tip/core/rcu 2/9] doc/RCU/Design: Remove remaining HTML tags in ReST files paulmck
2020-02-14 23:38 ` [PATCH tip/core/rcu 3/9] doc/RCU/listRCU: Fix typos in a example code snippets paulmck
2020-02-14 23:38 ` [PATCH tip/core/rcu 4/9] doc/RCU/listRCU: Update example function name paulmck
2020-02-14 23:38 ` [PATCH tip/core/rcu 5/9] doc/RCU/rcu: Use ':ref:' for links to other docs paulmck
2020-02-14 23:39 ` [PATCH tip/core/rcu 6/9] doc/RCU/rcu: Use absolute paths for non-rst files paulmck
2020-02-14 23:39 ` [PATCH tip/core/rcu 7/9] doc/RCU/rcu: Use https instead of http if possible paulmck
2020-02-14 23:39 ` [PATCH tip/core/rcu 8/9] doc: Add rcutorture scripting to torture.txt paulmck
2020-02-14 23:39 ` [PATCH tip/core/rcu 9/9] Documentation/memory-barriers: Fix typos paulmck
2020-11-21  0:59 ` [PATCH v2 tip/core/rcu 1/6] srcu: Make Tiny SRCU use multi-bit grace-period counter paulmck
2020-11-23  4:31   ` Neeraj Upadhyay
2020-11-23 19:55     ` Paul E. McKenney
2020-11-24  5:18       ` Neeraj Upadhyay
2020-11-25  4:33         ` Neeraj Upadhyay
2020-11-28  2:16           ` Paul E. McKenney
2020-11-28  4:12             ` Neeraj Upadhyay
2020-11-21  0:59 ` paulmck [this message]
2020-11-21  0:59 ` [PATCH v2 tip/core/rcu 3/6] srcu: Provide internal interface to start a Tree SRCU grace period paulmck
2020-11-21  0:59 ` [PATCH v2 tip/core/rcu 4/6] srcu: Provide polling interfaces for Tiny SRCU grace periods paulmck
2020-11-22 14:30   ` Neeraj Upadhyay
2020-11-22 17:57     ` Paul E. McKenney
2020-11-23  4:43   ` Neeraj Upadhyay
2020-11-23 21:12     ` Paul E. McKenney
2020-11-24  5:14       ` Neeraj Upadhyay
2020-11-24 19:30         ` Paul E. McKenney
2020-11-25  4:39           ` Neeraj Upadhyay
2020-11-21  0:59 ` [PATCH v2 tip/core/rcu 5/6] srcu: Provide polling interfaces for Tree " paulmck
2020-11-27  4:52   ` Neeraj Upadhyay
2020-11-21  0:59 ` [PATCH v2 tip/core/rcu 6/6] srcu: Document " paulmck
2020-11-27  8:27   ` Neeraj Upadhyay

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=20201121005919.17152-2-paulmck@kernel.org \
    --to=paulmck@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=kent.overstreet@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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).