From: Gautham R Shenoy <ego@in.ibm.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, mathieu.desnoyers@polymtl.ca,
mingo@elte.hu, akpm@linux-foundation.org, hch@infradead.org,
mmlnx@us.ibm.com, dipankar@in.ibm.com, dsmith@redhat.com,
rostedt@goodmis.org, adrian.bunk@movial.fi,
a.p.zijlstra@chello.nl, niv@us.ibm.com, dvhltc@us.ibm.com,
rusty@au1.ibm.com, jkenisto@linux.vnet.ibm.com, oleg@tv-sign.ru,
jamesclhuang@yahoo.com
Subject: Re: [PATCH 3/5] Add rcu_barrier_sched() and rcu_barrier_bh()
Date: Mon, 5 May 2008 14:52:40 +0530 [thread overview]
Message-ID: <20080505092240.GB8371@in.ibm.com> (raw)
In-Reply-To: <20080422004743.GC3693@linux.vnet.ibm.com>
On Mon, Apr 21, 2008 at 05:47:43PM -0700, Paul E. McKenney wrote:
> Add rcu_barrier_sched() and rcu_barrier_bh(). With these in place,
> rcutorture no longer gives the occasional oops when repeatedly starting
> and stopping torturing rcu_bh. Also adds the API needed to flush out
> pre-existing call_rcu_sched() callbacks.
>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> ---
>
> include/linux/rcupdate.h | 2 +
> kernel/rcupdate.c | 55 +++++++++++++++++++++++++++++++++++++++++------
> 2 files changed, 51 insertions(+), 6 deletions(-)
>
> diff -urpNa -X dontdiff linux-2.6.25-C2-rcuclassic-fixes/include/linux/rcupdate.h linux-2.6.25-C3-rcu_barrier_sched/include/linux/rcupdate.h
> --- linux-2.6.25-C2-rcuclassic-fixes/include/linux/rcupdate.h 2008-04-17 08:10:33.000000000 -0700
> +++ linux-2.6.25-C3-rcu_barrier_sched/include/linux/rcupdate.h 2008-04-21 11:33:07.000000000 -0700
> @@ -260,6 +260,8 @@ extern void call_rcu_bh(struct rcu_head
> /* Exported common interfaces */
> extern void synchronize_rcu(void);
> extern void rcu_barrier(void);
> +extern void rcu_barrier_bh(void);
> +extern void rcu_barrier_sched(void);
> extern long rcu_batches_completed(void);
> extern long rcu_batches_completed_bh(void);
>
> diff -urpNa -X dontdiff linux-2.6.25-C2-rcuclassic-fixes/kernel/rcupdate.c linux-2.6.25-C3-rcu_barrier_sched/kernel/rcupdate.c
> --- linux-2.6.25-C2-rcuclassic-fixes/kernel/rcupdate.c 2008-04-17 08:10:33.000000000 -0700
> +++ linux-2.6.25-C3-rcu_barrier_sched/kernel/rcupdate.c 2008-04-21 11:33:08.000000000 -0700
> @@ -45,6 +45,12 @@
> #include <linux/mutex.h>
> #include <linux/module.h>
>
> +enum rcu_barrier {
> + RCU_BARRIER_STD,
STD: Standard, I take it ?
> + 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);
> @@ -83,19 +89,30 @@ static void rcu_barrier_callback(struct
> /*
> * Called with preemption disabled, and from cross-cpu IRQ context.
> */
> -static void rcu_barrier_func(void *notused)
> +static void rcu_barrier_func(void *type)
> {
> int cpu = smp_processor_id();
> struct rcu_head *head = &per_cpu(rcu_barrier_head, cpu);
>
> atomic_inc(&rcu_barrier_cpu_count);
> - call_rcu(head, rcu_barrier_callback);
> + 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;
> + }
> }
>
> -/**
> - * rcu_barrier - Wait until all the in-flight RCUs are complete.
> +/*
> + * Orchestrate the specified type of RCU barrier, waiting for all
> + * RCU callbacks of the specified type to complete.
> */
> -void rcu_barrier(void)
> +static void _rcu_barrier(enum rcu_barrier type)
> {
> BUG_ON(in_interrupt());
> /* Take cpucontrol mutex to protect against CPU hotplug */
> @@ -111,13 +128,39 @@ void rcu_barrier(void)
> * until all the callbacks are queued.
> */
> rcu_read_lock();
> - on_each_cpu(rcu_barrier_func, NULL, 0, 1);
> + on_each_cpu(rcu_barrier_func, (void *)type, 0, 1);
> rcu_read_unlock();
> wait_for_completion(&rcu_barrier_completion);
> mutex_unlock(&rcu_barrier_mutex);
> }
> +
> +/**
> + * rcu_barrier - Wait until all in-flight call_rcu() callbacks complete.
> + */
> +void rcu_barrier(void)
> +{
> + _rcu_barrier(RCU_BARRIER_STD);
> +}
> EXPORT_SYMBOL_GPL(rcu_barrier);
>
> +/**
> + * rcu_barrier_bh - Wait until all in-flight call_rcu_bh() callbacks complete.
> + */
> +void rcu_barrier_bh(void)
> +{
> + _rcu_barrier(RCU_BARRIER_BH);
> +}
> +EXPORT_SYMBOL_GPL(rcu_barrier_bh);
> +
> +/**
> + * rcu_barrier_sched - Wait for in-flight call_rcu_sched() callbacks.
> + */
> +void rcu_barrier_sched(void)
> +{
> + _rcu_barrier(RCU_BARRIER_SCHED);
> +}
> +EXPORT_SYMBOL_GPL(rcu_barrier_sched);
> +
> void __init rcu_init(void)
> {
> __rcu_init();
--
Thanks and Regards
gautham
next prev parent reply other threads:[~2008-05-05 9:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-22 0:44 [PATCH 0/5] call_rcu_sched() series Paul E. McKenney
2008-04-22 0:45 ` Paul E. McKenney
2008-04-22 0:50 ` [PATCH 1/5] Add call_rcu_sched() Paul E. McKenney
2008-05-05 9:14 ` Gautham R Shenoy
2008-05-05 14:43 ` Paul E. McKenney
2008-04-22 0:46 ` [PATCH 2/5] Add memory barriers and comments to rcu_check_callbacks() Paul E. McKenney
2008-04-22 0:47 ` [PATCH 3/5] Add rcu_barrier_sched() and rcu_barrier_bh() Paul E. McKenney
2008-05-05 9:22 ` Gautham R Shenoy [this message]
2008-05-05 14:47 ` Paul E. McKenney
2008-05-05 17:42 ` Gautham R Shenoy
2008-05-06 5:37 ` Paul E. McKenney
2008-04-22 0:48 ` [PATCH 0/5] call_rcu_sched() series Paul E. McKenney
2008-04-22 0:51 ` Paul E. McKenney
2008-04-22 0:52 ` [PATCH 4/5] Add call_rcu_sched() and friends to rcutorture Paul E. McKenney
2008-04-22 0:49 ` [PATCH 5/5] 1Q08 RCU doc update, add call_rcu_sched() Paul E. McKenney
-- strict thread matches above, loose matches on Subject: below --
2008-04-14 3:58 [PATCH 0/5] call_rcu_sched() series Paul E. McKenney
2008-04-14 4:02 ` [PATCH 3/5] Add rcu_barrier_sched() and rcu_barrier_bh() 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=20080505092240.GB8371@in.ibm.com \
--to=ego@in.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=adrian.bunk@movial.fi \
--cc=akpm@linux-foundation.org \
--cc=dipankar@in.ibm.com \
--cc=dsmith@redhat.com \
--cc=dvhltc@us.ibm.com \
--cc=hch@infradead.org \
--cc=jamesclhuang@yahoo.com \
--cc=jkenisto@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=mmlnx@us.ibm.com \
--cc=niv@us.ibm.com \
--cc=oleg@tv-sign.ru \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=rusty@au1.ibm.com \
/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®