From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rcu: don't call rcu_preempt_note_context_switch() in rcu_check_callbacks()
Date: Sun, 28 Mar 2010 21:42:36 -0700 [thread overview]
Message-ID: <20100329044236.GB2343@linux.vnet.ibm.com> (raw)
In-Reply-To: <4BB014DF.9030905@cn.fujitsu.com>
On Mon, Mar 29, 2010 at 10:47:59AM +0800, Lai Jiangshan wrote:
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 7bit
>
>
> Even though in user mode or idle mode, rcu_check_callbacks() is not
> context switch, so we don't call rcu_preempt_note_context_switch()
> in rcu_check_callbacks().
>
> Though there is no harm that calls rcu_preempt_note_context_switch()
> in rcu_check_callbacks(), but it is waste.
>
> rcu_check_callbacks()
> rcu_sched_qs()
> rcu_preempt_note_context_switch()
> Now, ->rcu_read_lock_nesting == 0, so we just calls
> rcu_preempt_qs(), but, rcu_preempt_check_callbacks()
> will call it again and set the ->rcu_read_unlock_special
> correct again.
>
> So let rcu_preempt_check_callbacks() handle things for us.
Nice!!!
But how about naming the new function that invokes
rcu_preempt_note_context_switch() something like
rcu_sched_note_context_switch(), and then leaving the
name of rcu_sched_qs() the same (rather than changing
it to __rcu_sched_qs(), as below)?
This way, the names clearly call out what the function
is doing.
Or did I miss the point here?
Thanx, Paul
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index 3ec8160..c7847ba 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -95,7 +95,7 @@ static int rcu_gp_in_progress(struct rcu_state *rsp)
> * how many quiescent states passed, just if there was at least
> * one since the start of the grace period, this just sets a flag.
> */
> -void rcu_sched_qs(int cpu)
> +static void __rcu_sched_qs(int cpu)
> {
> struct rcu_data *rdp;
>
> @@ -103,6 +103,11 @@ void rcu_sched_qs(int cpu)
> rdp->passed_quiesc_completed = rdp->gpnum - 1;
> barrier();
> rdp->passed_quiesc = 1;
> +}
> +
> +void rcu_sched_qs(int cpu)
> +{
> + __rcu_sched_qs(cpu);
> rcu_preempt_note_context_switch(cpu);
> }
>
> @@ -1138,12 +1143,12 @@ void rcu_check_callbacks(int cpu, int user)
> * a quiescent state, so note it.
> *
> * No memory barrier is required here because both
> - * rcu_sched_qs() and rcu_bh_qs() reference only CPU-local
> + * __rcu_sched_qs() and rcu_bh_qs() reference only CPU-local
> * variables that other CPUs neither access nor modify,
> * at least not while the corresponding CPU is online.
> */
>
> - rcu_sched_qs(cpu);
> + __rcu_sched_qs(cpu);
> rcu_bh_qs(cpu);
>
> } else if (!in_softirq()) {
>
next prev parent reply other threads:[~2010-03-29 4:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-29 2:47 [PATCH] rcu: don't call rcu_preempt_note_context_switch() in rcu_check_callbacks() Lai Jiangshan
2010-03-29 4:42 ` Paul E. McKenney [this message]
2010-03-30 9:43 ` Lai Jiangshan
2010-03-30 16:03 ` Paul E. McKenney
2010-03-31 15:36 ` Paul E. McKenney
2010-04-01 0:56 ` Lai Jiangshan
2010-04-01 1:17 ` Paul E. McKenney
2010-04-01 7:24 ` Lai Jiangshan
2010-04-02 0:53 ` Paul E. McKenney
2010-04-02 12:27 ` Lai Jiangshan
2010-04-02 15:25 ` 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=20100329044236.GB2343@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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