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, dvhltc@us.ibm.com, niv@us.ibm.com,
tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org,
Valdis.Kletnieks@vt.edu, dhowells@redhat.com,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 1/3] rcu: replace the rcu_barrier enum with pointer to call_rcu*() function
Date: Mon, 28 Sep 2009 21:50:21 -0700 [thread overview]
Message-ID: <12541998232366-git-send-email-> (raw)
In-Reply-To: <20090929044955.GA12486@linux.vnet.ibm.com>
The rcu_barrier enum causes several problems: (1) you have to define
the enum somewhere, and there is no convenient place, (2) the difference
between TREE_RCU and TREE_PREEMPT_RCU causes problems when you need to
map from rcu_barrier enum to struct rcu_state, (3) the switch statement
are large, and (4) TINY_RCU really needs a different rcu_barrier()
than do the treercu implementations.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
kernel/rcupdate.c | 32 ++++++++++----------------------
1 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 2480534..fd3ec49 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -53,12 +53,6 @@ struct lockdep_map rcu_lock_map =
EXPORT_SYMBOL_GPL(rcu_lock_map);
#endif
-enum rcu_barrier {
- RCU_BARRIER_STD,
- RCU_BARRIER_BH,
- RCU_BARRIER_SCHED,
-};
-
static DEFINE_PER_CPU(struct rcu_head, rcu_barrier_head) = {NULL};
static atomic_t rcu_barrier_cpu_count;
static DEFINE_MUTEX(rcu_barrier_mutex);
@@ -188,19 +182,12 @@ 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));
atomic_inc(&rcu_barrier_cpu_count);
- switch ((enum rcu_barrier)type) {
- case RCU_BARRIER_STD:
- call_rcu(head, rcu_barrier_callback);
- break;
- case RCU_BARRIER_BH:
- call_rcu_bh(head, rcu_barrier_callback);
- break;
- case RCU_BARRIER_SCHED:
- call_rcu_sched(head, rcu_barrier_callback);
- break;
- }
+ call_rcu_func = type;
+ call_rcu_func(head, rcu_barrier_callback);
}
static inline void wait_migrated_callbacks(void)
@@ -213,7 +200,8 @@ static inline void wait_migrated_callbacks(void)
* Orchestrate the specified type of RCU barrier, waiting for all
* RCU callbacks of the specified type to complete.
*/
-static void _rcu_barrier(enum rcu_barrier type)
+static void _rcu_barrier(void (*call_rcu_func)(struct rcu_head *head,
+ void (*func)(struct rcu_head *head)))
{
BUG_ON(in_interrupt());
/* Take cpucontrol mutex to protect against CPU hotplug */
@@ -229,7 +217,7 @@ static void _rcu_barrier(enum rcu_barrier type)
* early.
*/
atomic_set(&rcu_barrier_cpu_count, 1);
- on_each_cpu(rcu_barrier_func, (void *)type, 1);
+ on_each_cpu(rcu_barrier_func, (void *)call_rcu_func, 1);
if (atomic_dec_and_test(&rcu_barrier_cpu_count))
complete(&rcu_barrier_completion);
wait_for_completion(&rcu_barrier_completion);
@@ -242,7 +230,7 @@ static void _rcu_barrier(enum rcu_barrier type)
*/
void rcu_barrier(void)
{
- _rcu_barrier(RCU_BARRIER_STD);
+ _rcu_barrier(call_rcu);
}
EXPORT_SYMBOL_GPL(rcu_barrier);
@@ -251,7 +239,7 @@ EXPORT_SYMBOL_GPL(rcu_barrier);
*/
void rcu_barrier_bh(void)
{
- _rcu_barrier(RCU_BARRIER_BH);
+ _rcu_barrier(call_rcu_bh);
}
EXPORT_SYMBOL_GPL(rcu_barrier_bh);
@@ -260,7 +248,7 @@ EXPORT_SYMBOL_GPL(rcu_barrier_bh);
*/
void rcu_barrier_sched(void)
{
- _rcu_barrier(RCU_BARRIER_SCHED);
+ _rcu_barrier(call_rcu_sched);
}
EXPORT_SYMBOL_GPL(rcu_barrier_sched);
--
1.5.2.5
next prev parent reply other threads:[~2009-09-29 4:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-29 4:49 [PATCH tip/core/rcu 0/3] rcu: simplify rcu_barrier() interaction with CPU hotplug Paul E. McKenney
2009-09-29 4:50 ` Paul E. McKenney [this message]
2009-10-01 7:46 ` [tip:core/rcu] rcu: Replace the rcu_barrier enum with pointer to call_rcu*() function tip-bot for Paul E. McKenney
2009-10-05 19:10 ` tip-bot for Paul E. McKenney
2009-09-29 4:50 ` [PATCH tip/core/rcu 2/3] rcu: move rcu_barrier() to rcutree, make lightweight rcu_barrier() for rcutiny Paul E. McKenney
2009-10-01 7:46 ` [tip:core/rcu] rcu: Move " tip-bot for Paul E. McKenney
2009-10-05 19:10 ` tip-bot for Paul E. McKenney
2009-09-29 4:50 ` [PATCH tip/core/rcu 3/3] rcu: make hot-unplugged CPU relinquish its own RCU callbacks Paul E. McKenney
2009-10-01 7:46 ` [tip:core/rcu] rcu: Make " tip-bot for Paul E. McKenney
2009-10-05 19:11 ` tip-bot for 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=12541998232366-git-send-email- \
--to=paulmck@linux.vnet.ibm.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhltc@us.ibm.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=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