Skip to contentSkip to conversation

rcu: don't set ->next_pending in rcu_start_batch()

PATCH In review Oleg Nesterov 2 participants 2 messages Jan 10, 2006 – Jan 11, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 rcu: don't set ->next_pending in rcu_start_batch()

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.

kernel/rcupdate.c renamed from kernel/rcupdate.c~2_NPEND +4 -7
@@ -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 {
Acked-by on v1 2/3
#1 lore raw
Quoted 3 lines · Oleg Nesterov

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

Quoted 38 lines
kernel/rcupdate.c renamed from kernel/rcupdate.c~2_NPEND +4 -7
@@ -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 {