From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, mingo@elte.hu,
akpm@linux-foundation.org, torvalds@linux-foundation.org,
davem@davemloft.net, dada1@cosmosbay.com, zbr@ioremap.net,
jeff.chua.linux@gmail.com, paulus@samba.org, jengelh@medozas.de,
r000n@r000n.net, benh@kernel.crashing.org,
mathieu.desnoyers@polymtl.ca
Subject: Re: [PATCH RFC] v1 expedited "big hammer" RCU grace periods
Date: Thu, 23 Apr 2009 08:15:09 -0700 [thread overview]
Message-ID: <20090423151509.GB6877@linux.vnet.ibm.com> (raw)
In-Reply-To: <49F006AE.5040104@cn.fujitsu.com>
On Thu, Apr 23, 2009 at 02:11:58PM +0800, Lai Jiangshan wrote:
> Paul E. McKenney wrote:
[ . . . ]
> Hi, Paul
>
> I just typed codes in email, very like these two pathes:
>
> [PATCH 1/2] sched: Introduce APIs for waiting multi events
> http://lkml.org/lkml/2009/4/14/733
>
> [PATCH 2/2] rcupdate: use struct ref_completion
> http://lkml.org/lkml/2009/4/14/734
>
> Lai.
> --------------
Interesting approach! This would get a second use for your multi-events
waiting code above. ;-)
Looks like the idea is to have the task doing the
synchronize_rcu_bh_expedited() hold a reference across the process,
and have each rcu_bh_fast_qs() also acquire a reference, which would
be released in the softirq handler synchronize_rcu_bh_expedited_help().
One question -- does this approach correctly handle all the CPU hotplug
scenarios? (I think that it might, but am not completely certain.)
Thanx, Paul
> #ifndef CONFIG_SMP
>
> static void __init synchronize_rcu_expedited_init(void)
> {
> }
>
> void synchronize_rcu_bh_expedited(void)
> {
> cond_resched();
> }
>
> #else /* #ifndef CONFIG_SMP */
>
> static DEFINE_MUTEX(synchronize_rcu_bh_mutex);
> static DEFINE_PER_CPU(int, call_only_once); /* is it need ? */
> static struct ref_completion rcu_bh_expedited_completion
>
> static void synchronize_rcu_bh_expedited_help(struct softirq_action *unused)
> {
> if (__get_cpu_var(call_only_once)) {
> smp_mb();
> ref_completion_put(&rcu_bh_expedited_completion);
> __get_cpu_var(call_only_once) = 0;
> }
> }
>
> static void rcu_bh_fast_qs(void *unused)
> {
> __get_cpu_var(call_only_once) = 1;
> ref_completion_get(&rcu_bh_expedited_completion);
> raise_softirq(RCU_EXPEDITED_SOFTIRQ);
> }
>
> static void __init synchronize_rcu_expedited_init(void)
> {
> open_softirq(RCU_EXPEDITED_SOFTIRQ, synchronize_rcu_bh_expedited_help);
> }
>
> void synchronize_rcu_bh_expedited(void)
> {
> mutex_lock(&synchronize_rcu_bh_mutex);
>
> ref_completion_get_init(&rcu_bh_expedited_completion);
>
> smp_call_function(rcu_bh_fast_qs, NULL, 1);
>
> ref_completion_put_init(&rcu_bh_expedited_completion);
> ref_completion_wait(&rcu_bh_expedited_completion);
>
> mutex_unlock(&synchronize_rcu_bh_mutex);
> }
>
> #endif /* #else #ifndef CONFIG_SMP */
>
next prev parent reply other threads:[~2009-04-23 15:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-23 5:25 [PATCH RFC] v1 expedited "big hammer" RCU grace periods Paul E. McKenney
2009-04-23 6:11 ` Lai Jiangshan
2009-04-23 15:15 ` Paul E. McKenney [this message]
2009-04-24 0:39 ` Lai Jiangshan
2009-04-24 1:13 ` Paul E. McKenney
2009-04-23 7:54 ` Ingo Molnar
2009-04-23 15:34 ` Paul E. McKenney
2009-04-23 15:47 ` Linus Torvalds
2009-04-23 18:29 ` Paul E. McKenney
2009-04-23 13:45 ` Mathieu Desnoyers
2009-04-23 16:54 ` 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=20090423151509.GB6877@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=jeff.chua.linux@gmail.com \
--cc=jengelh@medozas.de \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=r000n@r000n.net \
--cc=torvalds@linux-foundation.org \
--cc=zbr@ioremap.net \
/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).