提交 dbc1651f 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

[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: NOleg Nesterov <oleg@tv-sign.ru>
Acked-by: NPaul E. McKenney <paulmck@us.ibm.com>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 1fd5a46d
...@@ -236,12 +236,8 @@ static void rcu_do_batch(struct rcu_data *rdp) ...@@ -236,12 +236,8 @@ static void rcu_do_batch(struct rcu_data *rdp)
* active batch and the batch to be registered has not already occurred. * active batch and the batch to be registered has not already occurred.
* Caller must hold rcu_state.lock. * Caller must hold rcu_state.lock.
*/ */
static void rcu_start_batch(struct rcu_ctrlblk *rcp, struct rcu_state *rsp, static void rcu_start_batch(struct rcu_ctrlblk *rcp, struct rcu_state *rsp)
int next_pending)
{ {
if (next_pending)
rcp->next_pending = 1;
if (rcp->next_pending && if (rcp->next_pending &&
rcp->completed == rcp->cur) { rcp->completed == rcp->cur) {
rcp->next_pending = 0; rcp->next_pending = 0;
...@@ -275,7 +271,7 @@ static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp, struct rcu_state *rsp) ...@@ -275,7 +271,7 @@ static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp, struct rcu_state *rsp)
if (cpus_empty(rsp->cpumask)) { if (cpus_empty(rsp->cpumask)) {
/* batch completed ! */ /* batch completed ! */
rcp->completed = rcp->cur; rcp->completed = rcp->cur;
rcu_start_batch(rcp, rsp, 0); rcu_start_batch(rcp, rsp);
} }
} }
...@@ -410,7 +406,8 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp, ...@@ -410,7 +406,8 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp,
if (!rcp->next_pending) { if (!rcp->next_pending) {
/* and start it/schedule start if it's a new batch */ /* and start it/schedule start if it's a new batch */
spin_lock(&rsp->lock); spin_lock(&rsp->lock);
rcu_start_batch(rcp, rsp, 1); rcp->next_pending = 1;
rcu_start_batch(rcp, rsp);
spin_unlock(&rsp->lock); spin_unlock(&rsp->lock);
} }
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册