mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.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,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 50/52] rcu: Eliminate RCU-barrier use of rsp
Date: Wed, 29 Aug 2018 15:38:52 -0700	[thread overview]
Message-ID: <20180829223854.4055-50-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180829223830.GA1800@linux.vnet.ibm.com>

Now that there is only one rcu_state structure, there is less point
in maintaining a pointer to it.  This commit therefore replaces rsp
with &rcu_state in rcu_barrier_callback(), rcu_barrier_func(), and
_rcu_barrier().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/tree.c | 65 +++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 33 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 962b75c9722a..e573fb9f0ef8 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3128,32 +3128,31 @@ static void _rcu_barrier_trace(const char *s, int cpu, unsigned long done)
  */
 static void rcu_barrier_callback(struct rcu_head *rhp)
 {
-	struct rcu_state *rsp = &rcu_state;
-
-	if (atomic_dec_and_test(&rsp->barrier_cpu_count)) {
-		_rcu_barrier_trace(TPS("LastCB"), -1, rsp->barrier_sequence);
-		complete(&rsp->barrier_completion);
+	if (atomic_dec_and_test(&rcu_state.barrier_cpu_count)) {
+		_rcu_barrier_trace(TPS("LastCB"), -1,
+				   rcu_state.barrier_sequence);
+		complete(&rcu_state.barrier_completion);
 	} else {
-		_rcu_barrier_trace(TPS("CB"), -1, rsp->barrier_sequence);
+		_rcu_barrier_trace(TPS("CB"), -1, rcu_state.barrier_sequence);
 	}
 }
 
 /*
  * Called with preemption disabled, and from cross-cpu IRQ context.
  */
-static void rcu_barrier_func(void *type)
+static void rcu_barrier_func(void *unused)
 {
-	struct rcu_state *rsp = type;
 	struct rcu_data *rdp = raw_cpu_ptr(&rcu_data);
 
-	_rcu_barrier_trace(TPS("IRQ"), -1, rsp->barrier_sequence);
+	_rcu_barrier_trace(TPS("IRQ"), -1, rcu_state.barrier_sequence);
 	rdp->barrier_head.func = rcu_barrier_callback;
 	debug_rcu_head_queue(&rdp->barrier_head);
 	if (rcu_segcblist_entrain(&rdp->cblist, &rdp->barrier_head, 0)) {
-		atomic_inc(&rsp->barrier_cpu_count);
+		atomic_inc(&rcu_state.barrier_cpu_count);
 	} else {
 		debug_rcu_head_unqueue(&rdp->barrier_head);
-		_rcu_barrier_trace(TPS("IRQNQ"), -1, rsp->barrier_sequence);
+		_rcu_barrier_trace(TPS("IRQNQ"), -1,
+				   rcu_state.barrier_sequence);
 	}
 }
 
@@ -3165,25 +3164,25 @@ static void _rcu_barrier(void)
 {
 	int cpu;
 	struct rcu_data *rdp;
-	struct rcu_state *rsp = &rcu_state;
-	unsigned long s = rcu_seq_snap(&rsp->barrier_sequence);
+	unsigned long s = rcu_seq_snap(&rcu_state.barrier_sequence);
 
 	_rcu_barrier_trace(TPS("Begin"), -1, s);
 
 	/* Take mutex to serialize concurrent rcu_barrier() requests. */
-	mutex_lock(&rsp->barrier_mutex);
+	mutex_lock(&rcu_state.barrier_mutex);
 
 	/* Did someone else do our work for us? */
-	if (rcu_seq_done(&rsp->barrier_sequence, s)) {
-		_rcu_barrier_trace(TPS("EarlyExit"), -1, rsp->barrier_sequence);
+	if (rcu_seq_done(&rcu_state.barrier_sequence, s)) {
+		_rcu_barrier_trace(TPS("EarlyExit"), -1,
+				   rcu_state.barrier_sequence);
 		smp_mb(); /* caller's subsequent code after above check. */
-		mutex_unlock(&rsp->barrier_mutex);
+		mutex_unlock(&rcu_state.barrier_mutex);
 		return;
 	}
 
 	/* Mark the start of the barrier operation. */
-	rcu_seq_start(&rsp->barrier_sequence);
-	_rcu_barrier_trace(TPS("Inc1"), -1, rsp->barrier_sequence);
+	rcu_seq_start(&rcu_state.barrier_sequence);
+	_rcu_barrier_trace(TPS("Inc1"), -1, rcu_state.barrier_sequence);
 
 	/*
 	 * Initialize the count to one rather than to zero in order to
@@ -3191,8 +3190,8 @@ static void _rcu_barrier(void)
 	 * (or preemption of this task).  Exclude CPU-hotplug operations
 	 * to ensure that no offline CPU has callbacks queued.
 	 */
-	init_completion(&rsp->barrier_completion);
-	atomic_set(&rsp->barrier_cpu_count, 1);
+	init_completion(&rcu_state.barrier_completion);
+	atomic_set(&rcu_state.barrier_cpu_count, 1);
 	get_online_cpus();
 
 	/*
@@ -3207,22 +3206,22 @@ static void _rcu_barrier(void)
 		if (rcu_is_nocb_cpu(cpu)) {
 			if (!rcu_nocb_cpu_needs_barrier(cpu)) {
 				_rcu_barrier_trace(TPS("OfflineNoCB"), cpu,
-						   rsp->barrier_sequence);
+						   rcu_state.barrier_sequence);
 			} else {
 				_rcu_barrier_trace(TPS("OnlineNoCB"), cpu,
-						   rsp->barrier_sequence);
+						   rcu_state.barrier_sequence);
 				smp_mb__before_atomic();
-				atomic_inc(&rsp->barrier_cpu_count);
+				atomic_inc(&rcu_state.barrier_cpu_count);
 				__call_rcu(&rdp->barrier_head,
 					   rcu_barrier_callback, cpu, 0);
 			}
 		} else if (rcu_segcblist_n_cbs(&rdp->cblist)) {
 			_rcu_barrier_trace(TPS("OnlineQ"), cpu,
-					   rsp->barrier_sequence);
-			smp_call_function_single(cpu, rcu_barrier_func, rsp, 1);
+					   rcu_state.barrier_sequence);
+			smp_call_function_single(cpu, rcu_barrier_func, NULL, 1);
 		} else {
 			_rcu_barrier_trace(TPS("OnlineNQ"), cpu,
-					   rsp->barrier_sequence);
+					   rcu_state.barrier_sequence);
 		}
 	}
 	put_online_cpus();
@@ -3231,18 +3230,18 @@ static void _rcu_barrier(void)
 	 * Now that we have an rcu_barrier_callback() callback on each
 	 * CPU, and thus each counted, remove the initial count.
 	 */
-	if (atomic_dec_and_test(&rsp->barrier_cpu_count))
-		complete(&rsp->barrier_completion);
+	if (atomic_dec_and_test(&rcu_state.barrier_cpu_count))
+		complete(&rcu_state.barrier_completion);
 
 	/* Wait for all rcu_barrier_callback() callbacks to be invoked. */
-	wait_for_completion(&rsp->barrier_completion);
+	wait_for_completion(&rcu_state.barrier_completion);
 
 	/* Mark the end of the barrier operation. */
-	_rcu_barrier_trace(TPS("Inc2"), -1, rsp->barrier_sequence);
-	rcu_seq_end(&rsp->barrier_sequence);
+	_rcu_barrier_trace(TPS("Inc2"), -1, rcu_state.barrier_sequence);
+	rcu_seq_end(&rcu_state.barrier_sequence);
 
 	/* Other rcu_barrier() invocations can now safely proceed. */
-	mutex_unlock(&rsp->barrier_mutex);
+	mutex_unlock(&rcu_state.barrier_mutex);
 }
 
 /**
-- 
2.17.1


  parent reply	other threads:[~2018-08-29 22:39 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 22:38 [PATCH tip/core/rcu 0/52] Remove rcu_state pointers for v4.20/v5.0 Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 01/52] rcu: Remove rsp parameter from rcu_report_qs_rnp() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 02/52] rcu: Remove rsp parameter from rcu_report_qs_rsp() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 03/52] rcu: Remove rsp parameter from rcu_report_unblock_qs_rnp() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 04/52] rcu: Remove rsp parameter from rcu_report_qs_rdp() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 05/52] rcu: Remove rsp parameter from rcu_gp_in_progress() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 06/52] rcu: Remove rsp parameter from rcu_get_root() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 07/52] rcu: Remove rsp parameter from record_gp_stall_check_time() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 08/52] rcu: Remove rsp parameter from rcu_check_gp_kthread_starvation() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 09/52] rcu: Remove rsp parameter from rcu_dump_cpu_stacks() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 10/52] rcu: Remove rsp parameter from rcu_stall_kick_kthreads() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 11/52] rcu: Remove rsp parameter from print_other_cpu_stall() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 12/52] rcu: Remove rsp parameter from print_cpu_stall() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 13/52] rcu: Remove rsp parameter from check_cpu_stall() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 14/52] rcu: Remove rsp parameter from rcu_future_gp_cleanup() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 15/52] rcu: Remove rsp parameter from rcu_gp_kthread_wake() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 16/52] rcu: Remove rsp parameter from rcu_accelerate_cbs() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 17/52] rcu: Remove rsp parameter from rcu_accelerate_cbs_unlocked() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 18/52] rcu: Remove rsp parameter from rcu_advance_cbs() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 19/52] rcu: Remove rsp parameter from __note_gp_changes() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 20/52] rcu: Remove rsp parameter from note_gp_changes() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 21/52] rcu: Remove rsp parameter from rcu_gp_slow() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 22/52] rcu: Remove rsp parameter from rcu_gp_kthread() and friends Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 23/52] rcu: Remove rsp parameter from rcu_check_quiescent_state() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 24/52] rcu: Remove rsp parameter from CPU hotplug functions Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 25/52] rcu: Remove rsp parameter from rcu_do_batch() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 26/52] rcu: Remove rsp parameter from force-quiescent-state functions Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 27/52] rcu: Remove rsp parameter from rcu_check_gp_start_stall() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 28/52] rcu: Remove rsp parameter from __rcu_process_callbacks() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 29/52] rcu: Remove rsp parameter from __call_rcu() and friend Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 30/52] rcu: Remove rsp parameter from __rcu_pending() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 31/52] rcu: Remove rsp parameter from _rcu_barrier() and friends Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 32/52] rcu: Remove rsp parameter from rcu_boot_init_percpu_data() " Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 33/52] rcu: Remove rsp parameter from rcu_init_one() " Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 34/52] rcu: Remove rsp parameter from rcu_print_detail_task_stall() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 35/52] rcu: Remove rsp parameter from dump_blkd_tasks() and friend Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 36/52] rcu: Remove rsp parameter from rcu_spawn_one_boost_kthread() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 37/52] rcu: Remove rsp parameter from print_cpu_stall_info() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 38/52] rcu: Remove rsp parameter from no-CBs CPU functions Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 39/52] rcu: Remove rsp parameter from expedited grace-period functions Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 40/52] rcu: Remove rsp parameter from rcu_node tree accessor macros Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 41/52] rcu: Remove rcu_data structure's ->rsp field Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 42/52] rcu: Remove last non-flavor-traversal rsp local variable from tree_plugin.h Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 43/52] rcu: Remove for_each_rcu_flavor() flavor-traversal macro Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 44/52] rcu: Simplify rcutorture_get_gp_data() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 45/52] rcu: Restructure rcu_check_gp_kthread_starvation() Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 46/52] rcu: Eliminate stall-warning use of rsp Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 47/52] rcu: Eliminate grace-period management code " Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 48/52] rcu: Eliminate callback-invocation/invocation " Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 49/52] rcu: Eliminate quiescent-state and grace-period-nonstart " Paul E. McKenney
2018-08-29 22:38 ` Paul E. McKenney [this message]
2018-08-29 22:38 ` [PATCH tip/core/rcu 51/52] rcu: Eliminate initialization-time " Paul E. McKenney
2018-08-29 22:38 ` [PATCH tip/core/rcu 52/52] rcu: Fix typo in force_qs_rnp()'s parameter's parameter Paul E. McKenney
2018-08-30  2:00 ` [PATCH tip/core/rcu 0/52] Remove rcu_state pointers for v4.20/v5.0 Steven Rostedt
2018-08-30  3:22   ` Paul E. McKenney
2018-08-30  4:10     ` Paul E. McKenney
2018-08-30  4:20       ` Josh Triplett
2018-08-30 15:42         ` Steven Rostedt
2018-08-30 15:44       ` Steven Rostedt
2018-08-30 17:10         ` Paul E. McKenney
2018-08-30 17:40           ` Steven Rostedt
2018-08-30 18:26             ` 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=20180829223854.4055-50-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.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

all inboxes | Powered by JetHome®