public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: paulmck@linux.vnet.ibm.com
Cc: Chen Gang F T <chen.gang.flying.transformer@gmail.com>,
	dipankar@in.ibm.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/rcutree.c: deem to be lazy if there are no callbacks.
Date: Wed, 04 Sep 2013 09:57:24 +0800	[thread overview]
Message-ID: <52269384.4040802@asianux.com> (raw)
In-Reply-To: <20130903175910.GX3871@linux.vnet.ibm.com>

On 09/04/2013 01:59 AM, Paul E. McKenney wrote:
> On Tue, Sep 03, 2013 at 01:41:03PM +0800, Chen Gang wrote:
>> Hello Maintainers:
>>
>> Is this issue finished ?
>>
>> If need additional help from me (e.g. some test things, or others, if
>> you have no time, can let me try), please let me know, I should try.
> 
> Ah, sorry, here is the patch.
> 

Thanks.

:-)

> 							Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
>     rcu: Micro-optimize rcu_cpu_has_callbacks()
>     
>     The for_each_rcu_flavor() loop unconditionally scans all flavors, even
>     when the first flavor might have some non-lazy callbacks.  Once the
>     loop has seen a non-lazy callback, further passes through the loop
>     cannot change the state.  This is not a huge problem, given that there
>     can be at most three RCU flavors (RCU-bh, RCU-preempt, and RCU-sched),
>     but this code is on the path to idle, so speeding it up even a small
>     amount would have some benefit.
>     
>     This commit therefore does two things:
>     
>     1.	Rearranges the order of the list of RCU flavors in order to
>     	place the most active flavor first in the list.  The most active
>     	RCU flavor is RCU-preempt, or, if there is no RCU-preempt,
>     	RCU-sched.
>     
>     2.	Reworks the for_each_rcu_flavor() to exit early when the first
>     	non-lazy callback is seen, or, in the case where the caller
>     	does not care about non-lazy callbacks (RCU_FAST_NO_HZ=n),
>     	when the first callback is seen.
>     
>     Reported-by: Chen Gang <gang.chen@asianux.com>
>     Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index b1b959d..38596be 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -2756,10 +2756,13 @@ static int rcu_cpu_has_callbacks(int cpu, bool *all_lazy)
>  
>  	for_each_rcu_flavor(rsp) {
>  		rdp = per_cpu_ptr(rsp->rda, cpu);
> -		if (rdp->qlen != rdp->qlen_lazy)
> +		if (!rdp->nxtlist)
> +			continue;
> +		hc = true;
> +		if (rdp->qlen != rdp->qlen_lazy || !all_lazy) {
>  			al = false;
> -		if (rdp->nxtlist)
> -			hc = true;
> +			break;
> +		}
>  	}
>  	if (all_lazy)
>  		*all_lazy = al;
> @@ -3326,8 +3329,8 @@ void __init rcu_init(void)
>  
>  	rcu_bootup_announce();
>  	rcu_init_geometry();
> -	rcu_init_one(&rcu_sched_state, &rcu_sched_data);
>  	rcu_init_one(&rcu_bh_state, &rcu_bh_data);
> +	rcu_init_one(&rcu_sched_state, &rcu_sched_data);
>  	__rcu_init_preempt();
>  	open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
>  
> 
> 
> 


-- 
Chen Gang

  reply	other threads:[~2013-09-04  1:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20  3:50 [PATCH] kernel/rcutree.c: deem to be lazy if there are no callbacks Chen Gang
2013-08-20  3:51 ` Chen Gang
2013-08-20  4:18   ` Paul E. McKenney
2013-08-20  4:43     ` Chen Gang
2013-08-20  4:45       ` Chen Gang
2013-08-21  5:59         ` Chen Gang
2013-08-21 14:23           ` Paul E. McKenney
2013-08-22  3:01             ` Chen Gang
2013-08-25 19:18               ` Paul E. McKenney
2013-08-26  2:21                 ` Chen Gang F T
2013-09-03  5:41                   ` Chen Gang
2013-09-03 17:59                     ` Paul E. McKenney
2013-09-04  1:57                       ` Chen Gang [this message]
2013-09-03 19:36                   ` Paul E. McKenney
2013-09-04  2:41                     ` Chen Gang F T
2013-08-20  4:10 ` Paul E. McKenney
2013-08-20  4:30   ` Chen Gang

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=52269384.4040802@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=chen.gang.flying.transformer@gmail.com \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.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