Skip to content

Commit dbc1651

Browse files
Oleg NesterovLinus Torvalds
authored andcommitted
[PATCH] 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. Signed-off-by: Oleg Nesterov <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1fd5a46 commit dbc1651

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

kernel/rcupdate.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,8 @@ static void rcu_do_batch(struct rcu_data *rdp)
236236
* active batch and the batch to be registered has not already occurred.
237237
* Caller must hold rcu_state.lock.
238238
*/
239-
static void rcu_start_batch(struct rcu_ctrlblk *rcp, struct rcu_state *rsp,
240-
int next_pending)
239+
static void rcu_start_batch(struct rcu_ctrlblk *rcp, struct rcu_state *rsp)
241240
{
242-
if (next_pending)
243-
rcp->next_pending = 1;
244-
245241
if (rcp->next_pending &&
246242
rcp->completed == rcp->cur) {
247243
rcp->next_pending = 0;
@@ -275,7 +271,7 @@ static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp, struct rcu_state *rsp)
275271
if (cpus_empty(rsp->cpumask)) {
276272
/* batch completed ! */
277273
rcp->completed = rcp->cur;
278-
rcu_start_batch(rcp, rsp, 0);
274+
rcu_start_batch(rcp, rsp);
279275
}
280276
}
281277

@@ -410,7 +406,8 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp,
410406
if (!rcp->next_pending) {
411407
/* and start it/schedule start if it's a new batch */
412408
spin_lock(&rsp->lock);
413-
rcu_start_batch(rcp, rsp, 1);
409+
rcp->next_pending = 1;
410+
rcu_start_batch(rcp, rsp);
414411
spin_unlock(&rsp->lock);
415412
}
416413
} else {

0 commit comments

Comments
 (0)