linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] rcu: don't set ->next_pending in rcu_start_batch()
@ 2006-01-10 13:46 Oleg Nesterov
  2006-01-11  4:33 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2006-01-10 13:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dipankar Sarma, Manfred Spraul, Linus Torvalds, Paul E. McKenney,
	Andrew Morton

I think it is better to set ->next_pending in the caller, when
it is needed. This saves one parameter, and this coincides with
cpu_quiet() beahaviour, which sets ->completed = ->cur itself.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 2.6.15/kernel/rcupdate.c~2_NPEND	2006-01-10 18:35:45.000000000 +0300
+++ 2.6.15/kernel/rcupdate.c	2006-01-10 18:39:08.000000000 +0300
@@ -249,12 +249,8 @@ static void rcu_do_batch(struct rcu_data
  * active batch and the batch to be registered has not already occurred.
  * Caller must hold rcu_state.lock.
  */
-static void rcu_start_batch(struct rcu_ctrlblk *rcp, struct rcu_state *rsp,
-				int next_pending)
+static void rcu_start_batch(struct rcu_ctrlblk *rcp, struct rcu_state *rsp)
 {
-	if (next_pending)
-		rcp->next_pending = 1;
-
 	if (rcp->next_pending &&
 			rcp->completed == rcp->cur) {
 		rcp->next_pending = 0;
@@ -288,7 +284,7 @@ static void cpu_quiet(int cpu, struct rc
 	if (cpus_empty(rsp->cpumask)) {
 		/* batch completed ! */
 		rcp->completed = rcp->cur;
-		rcu_start_batch(rcp, rsp, 0);
+		rcu_start_batch(rcp, rsp);
 	}
 }
 
@@ -423,7 +419,8 @@ static void __rcu_process_callbacks(stru
 		if (!rcp->next_pending) {
 			/* and start it/schedule start if it's a new batch */
 			spin_lock(&rsp->lock);
-			rcu_start_batch(rcp, rsp, 1);
+			rcp->next_pending = 1;
+			rcu_start_batch(rcp, rsp);
 			spin_unlock(&rsp->lock);
 		}
 	} else {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] rcu: don't set ->next_pending in rcu_start_batch()
  2006-01-10 13:46 [PATCH 2/3] rcu: don't set ->next_pending in rcu_start_batch() Oleg Nesterov
@ 2006-01-11  4:33 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2006-01-11  4:33 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: linux-kernel, Dipankar Sarma, Manfred Spraul, Linus Torvalds,
	Andrew Morton

On Tue, Jan 10, 2006 at 04:46:42PM +0300, Oleg Nesterov wrote:
> I think it is better to set ->next_pending in the caller, when
> it is needed. This saves one parameter, and this coincides with
> cpu_quiet() beahaviour, which sets ->completed = ->cur itself.

Looks good to me, passes a one-hour torture test on x86.

						Thanx, Paul

Acked-by: Paul E. McKenney <paulmck@us.ibm.com>
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> 
> --- 2.6.15/kernel/rcupdate.c~2_NPEND	2006-01-10 18:35:45.000000000 +0300
> +++ 2.6.15/kernel/rcupdate.c	2006-01-10 18:39:08.000000000 +0300
> @@ -249,12 +249,8 @@ static void rcu_do_batch(struct rcu_data
>   * active batch and the batch to be registered has not already occurred.
>   * Caller must hold rcu_state.lock.
>   */
> -static void rcu_start_batch(struct rcu_ctrlblk *rcp, struct rcu_state *rsp,
> -				int next_pending)
> +static void rcu_start_batch(struct rcu_ctrlblk *rcp, struct rcu_state *rsp)
>  {
> -	if (next_pending)
> -		rcp->next_pending = 1;
> -
>  	if (rcp->next_pending &&
>  			rcp->completed == rcp->cur) {
>  		rcp->next_pending = 0;
> @@ -288,7 +284,7 @@ static void cpu_quiet(int cpu, struct rc
>  	if (cpus_empty(rsp->cpumask)) {
>  		/* batch completed ! */
>  		rcp->completed = rcp->cur;
> -		rcu_start_batch(rcp, rsp, 0);
> +		rcu_start_batch(rcp, rsp);
>  	}
>  }
>  
> @@ -423,7 +419,8 @@ static void __rcu_process_callbacks(stru
>  		if (!rcp->next_pending) {
>  			/* and start it/schedule start if it's a new batch */
>  			spin_lock(&rsp->lock);
> -			rcu_start_batch(rcp, rsp, 1);
> +			rcp->next_pending = 1;
> +			rcu_start_batch(rcp, rsp);
>  			spin_unlock(&rsp->lock);
>  		}
>  	} else {
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-11  4:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-10 13:46 [PATCH 2/3] rcu: don't set ->next_pending in rcu_start_batch() Oleg Nesterov
2006-01-11  4:33 ` Paul E. McKenney

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).