From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org,
Valdis.Kletnieks@vt.edu, dhowells@redhat.com,
eric.dumazet@gmail.com, darren@dvhart.com, fweisbec@gmail.com,
patches@linaro.org, "Paul E. McKenney" <paul.mckenney@linaro.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 04/15] rcu: Place pointer to call_rcu() in rcu_data structure
Date: Fri, 15 Jun 2012 14:05:59 -0700 [thread overview]
Message-ID: <1339794370-28119-4-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <1339794370-28119-1-git-send-email-paulmck@linux.vnet.ibm.com>
From: "Paul E. McKenney" <paul.mckenney@linaro.org>
This is a preparatory commit for increasing rcu_barrier()'s concurrency.
It adds a pointer in the rcu_data structure to the corresponding call_rcu()
function. This allows a pointer to the rcu_data structure to imply the
function pointer, which allows _rcu_barrier() state to be placed in the
rcu_state structure.
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcutree.c | 27 ++++++++++++---------------
kernel/rcutree.h | 2 ++
kernel/rcutree_plugin.h | 5 +++--
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 8ce1b1d..8b3ab4e 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -62,8 +62,9 @@
static struct lock_class_key rcu_node_class[RCU_NUM_LVLS];
-#define RCU_STATE_INITIALIZER(sname) { \
+#define RCU_STATE_INITIALIZER(sname, cr) { \
.level = { &sname##_state.node[0] }, \
+ .call = cr, \
.fqs_state = RCU_GP_IDLE, \
.gpnum = -300, \
.completed = -300, \
@@ -76,10 +77,11 @@ static struct lock_class_key rcu_node_class[RCU_NUM_LVLS];
.name = #sname, \
}
-struct rcu_state rcu_sched_state = RCU_STATE_INITIALIZER(rcu_sched);
+struct rcu_state rcu_sched_state =
+ RCU_STATE_INITIALIZER(rcu_sched, call_rcu_sched);
DEFINE_PER_CPU(struct rcu_data, rcu_sched_data);
-struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh);
+struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh, call_rcu_bh);
DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
static struct rcu_state *rcu_state;
@@ -2279,21 +2281,17 @@ static void rcu_barrier_func(void *type)
{
int cpu = smp_processor_id();
struct rcu_head *head = &per_cpu(rcu_barrier_head, cpu);
- void (*call_rcu_func)(struct rcu_head *head,
- void (*func)(struct rcu_head *head));
+ struct rcu_state *rsp = type;
atomic_inc(&rcu_barrier_cpu_count);
- call_rcu_func = type;
- call_rcu_func(head, rcu_barrier_callback);
+ rsp->call(head, rcu_barrier_callback);
}
/*
* Orchestrate the specified type of RCU barrier, waiting for all
* RCU callbacks of the specified type to complete.
*/
-static void _rcu_barrier(struct rcu_state *rsp,
- void (*call_rcu_func)(struct rcu_head *head,
- void (*func)(struct rcu_head *head)))
+static void _rcu_barrier(struct rcu_state *rsp)
{
int cpu;
unsigned long flags;
@@ -2345,8 +2343,7 @@ static void _rcu_barrier(struct rcu_state *rsp,
while (cpu_is_offline(cpu) && ACCESS_ONCE(rdp->qlen))
schedule_timeout_interruptible(1);
} else if (ACCESS_ONCE(rdp->qlen)) {
- smp_call_function_single(cpu, rcu_barrier_func,
- (void *)call_rcu_func, 1);
+ smp_call_function_single(cpu, rcu_barrier_func, rsp, 1);
preempt_enable();
} else {
preempt_enable();
@@ -2367,7 +2364,7 @@ static void _rcu_barrier(struct rcu_state *rsp,
raw_spin_unlock_irqrestore(&rsp->onofflock, flags);
atomic_inc(&rcu_barrier_cpu_count);
smp_mb__after_atomic_inc(); /* Ensure atomic_inc() before callback. */
- call_rcu_func(&rh, rcu_barrier_callback);
+ rsp->call(&rh, rcu_barrier_callback);
/*
* Now that we have an rcu_barrier_callback() callback on each
@@ -2390,7 +2387,7 @@ static void _rcu_barrier(struct rcu_state *rsp,
*/
void rcu_barrier_bh(void)
{
- _rcu_barrier(&rcu_bh_state, call_rcu_bh);
+ _rcu_barrier(&rcu_bh_state);
}
EXPORT_SYMBOL_GPL(rcu_barrier_bh);
@@ -2399,7 +2396,7 @@ EXPORT_SYMBOL_GPL(rcu_barrier_bh);
*/
void rcu_barrier_sched(void)
{
- _rcu_barrier(&rcu_sched_state, call_rcu_sched);
+ _rcu_barrier(&rcu_sched_state);
}
EXPORT_SYMBOL_GPL(rcu_barrier_sched);
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index df3c2c8..15837d7 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -350,6 +350,8 @@ struct rcu_state {
u32 levelcnt[MAX_RCU_LVLS + 1]; /* # nodes in each level. */
u8 levelspread[RCU_NUM_LVLS]; /* kids/node in each level. */
struct rcu_data __percpu *rda; /* pointer of percu rcu_data. */
+ void (*call)(struct rcu_head *head, /* call_rcu() flavor. */
+ void (*func)(struct rcu_head *head));
/* The following fields are guarded by the root rcu_node's lock. */
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 7cb86ae..6888706 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -78,7 +78,8 @@ static void __init rcu_bootup_announce_oddness(void)
#ifdef CONFIG_TREE_PREEMPT_RCU
-struct rcu_state rcu_preempt_state = RCU_STATE_INITIALIZER(rcu_preempt);
+struct rcu_state rcu_preempt_state =
+ RCU_STATE_INITIALIZER(rcu_preempt, call_rcu);
DEFINE_PER_CPU(struct rcu_data, rcu_preempt_data);
static struct rcu_state *rcu_state = &rcu_preempt_state;
@@ -944,7 +945,7 @@ static int rcu_preempt_cpu_has_callbacks(int cpu)
*/
void rcu_barrier(void)
{
- _rcu_barrier(&rcu_preempt_state, call_rcu);
+ _rcu_barrier(&rcu_preempt_state);
}
EXPORT_SYMBOL_GPL(rcu_barrier);
--
1.7.8
next prev parent reply other threads:[~2012-06-15 21:09 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 21:05 [PATCH tip/core/rcu 0/15] Improvements to rcu_barrier() and RT response on big systems Paul E. McKenney
2012-06-15 21:05 ` [PATCH tip/core/rcu 01/15] rcu: Control RCU_FANOUT_LEAF from boot-time parameter Paul E. McKenney
2012-06-15 21:05 ` [PATCH tip/core/rcu 02/15] rcu: Size rcu_node tree from nr_cpu_ids rather than NR_CPUS Paul E. McKenney
2012-06-15 21:47 ` Josh Triplett
2012-06-16 0:37 ` Paul E. McKenney
2012-06-16 5:17 ` Josh Triplett
2012-06-16 6:38 ` Paul E. McKenney
2012-06-16 9:17 ` Josh Triplett
2012-06-16 14:44 ` Paul E. McKenney
2012-06-16 14:51 ` Paul E. McKenney
2012-06-16 20:31 ` Josh Triplett
2012-06-15 21:05 ` [PATCH tip/core/rcu 03/15] rcu: Prevent excessive line length in RCU_STATE_INITIALIZER() Paul E. McKenney
2012-06-15 21:48 ` Josh Triplett
2012-06-15 21:05 ` Paul E. McKenney [this message]
2012-06-15 22:08 ` [PATCH tip/core/rcu 04/15] rcu: Place pointer to call_rcu() in rcu_data structure Josh Triplett
2012-06-15 21:06 ` [PATCH tip/core/rcu 05/15] rcu: Move _rcu_barrier()'s rcu_head structures to rcu_data structures Paul E. McKenney
2012-06-15 22:19 ` Josh Triplett
2012-06-15 21:06 ` [PATCH tip/core/rcu 06/15] rcu: Move rcu_barrier_cpu_count to rcu_state structure Paul E. McKenney
2012-06-15 22:44 ` Josh Triplett
2012-06-15 21:06 ` [PATCH tip/core/rcu 07/15] rcu: Move rcu_barrier_completion " Paul E. McKenney
2012-06-15 22:51 ` Josh Triplett
2012-06-15 21:06 ` [PATCH tip/core/rcu 08/15] rcu: Move rcu_barrier_mutex " Paul E. McKenney
2012-06-15 22:55 ` Josh Triplett
2012-06-15 21:06 ` [PATCH tip/core/rcu 09/15] rcu: Increasing rcu_barrier() concurrency Paul E. McKenney
2012-06-15 23:31 ` Josh Triplett
2012-06-16 0:21 ` Steven Rostedt
2012-06-16 0:49 ` Paul E. McKenney
2012-06-16 0:48 ` Paul E. McKenney
2012-06-15 21:06 ` [PATCH tip/core/rcu 10/15] rcu: Add tracing for _rcu_barrier() Paul E. McKenney
2012-06-15 23:35 ` Josh Triplett
2012-06-15 21:06 ` [PATCH tip/core/rcu 11/15] rcu: Add rcu_barrier() statistics to debugfs tracing Paul E. McKenney
2012-06-15 23:38 ` Josh Triplett
2012-06-15 21:06 ` [PATCH tip/core/rcu 12/15] rcu: Remove unneeded __rcu_process_callbacks() argument Paul E. McKenney
2012-06-15 23:37 ` Josh Triplett
2012-06-15 21:06 ` [PATCH tip/core/rcu 13/15] rcu: Introduce for_each_rcu_flavor() and use it Paul E. McKenney
2012-06-15 23:52 ` Josh Triplett
2012-06-16 1:01 ` Paul E. McKenney
2012-06-16 5:35 ` Josh Triplett
2012-06-16 6:36 ` Paul E. McKenney
2012-06-15 21:06 ` [PATCH tip/core/rcu 14/15] rcu: Use for_each_rcu_flavor() in TREE_RCU tracing Paul E. McKenney
2012-06-15 23:59 ` Josh Triplett
2012-06-16 0:56 ` Paul E. McKenney
2012-06-16 5:22 ` Josh Triplett
2012-06-16 6:42 ` Paul E. McKenney
2012-06-15 21:06 ` [PATCH tip/core/rcu 15/15] rcu: RCU_SAVE_DYNTICK code no longer ever dead Paul E. McKenney
2012-06-16 0:02 ` Josh Triplett
2012-06-16 0:04 ` Josh Triplett
2012-06-16 1:04 ` Paul E. McKenney
2012-06-15 21:43 ` [PATCH tip/core/rcu 01/15] rcu: Control RCU_FANOUT_LEAF from boot-time parameter Josh Triplett
2012-06-15 22:10 ` 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=1339794370-28119-4-git-send-email-paulmck@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=darren@dvhart.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=eric.dumazet@gmail.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=niv@us.ibm.com \
--cc=patches@linaro.org \
--cc=paul.mckenney@linaro.org \
--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®