|
|
9765980 |
rcu: Avoid having just-onlined CPU resched itself when RCU is idle
|
|
|
9765980 |
|
|
|
9765980 |
CPUs set rdp->qs_pending when coming online to resolve races with
|
|
|
9765980 |
grace-period start. However, this means that if RCU is idle, the
|
|
|
9765980 |
just-onlined CPU might needlessly send itself resched IPIs. Adjust
|
|
|
9765980 |
the online-CPU initialization to avoid this, and also to correctly
|
|
|
9765980 |
cause the CPU to respond to the current grace period if needed.
|
|
|
9765980 |
|
|
|
9765980 |
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
|
|
|
9765980 |
---
|
|
|
9765980 |
kernel/rcutree.c | 13 +++++++++----
|
|
|
9765980 |
1 files changed, 9 insertions(+), 4 deletions(-)
|
|
|
9765980 |
|
|
|
9765980 |
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
|
|
|
9765980 |
index ba06207..472d6b2 100644
|
|
|
9765980 |
--- a/kernel/rcutree.c
|
|
|
9765980 |
+++ b/kernel/rcutree.c
|
|
|
9765980 |
@@ -1865,8 +1865,6 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptible)
|
|
|
9765980 |
|
|
|
9765980 |
/* Set up local state, ensuring consistent view of global state. */
|
|
|
9765980 |
raw_spin_lock_irqsave(&rnp->lock, flags);
|
|
|
9765980 |
- rdp->passed_quiesc = 0; /* We could be racing with new GP, */
|
|
|
9765980 |
- rdp->qs_pending = 1; /* so set up to respond to current GP. */
|
|
|
9765980 |
rdp->beenonline = 1; /* We have now been online. */
|
|
|
9765980 |
rdp->preemptible = preemptible;
|
|
|
9765980 |
rdp->qlen_last_fqs_check = 0;
|
|
|
9765980 |
@@ -1891,8 +1889,15 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptible)
|
|
|
9765980 |
rnp->qsmaskinit |= mask;
|
|
|
9765980 |
mask = rnp->grpmask;
|
|
|
9765980 |
if (rnp == rdp->mynode) {
|
|
|
9765980 |
- rdp->gpnum = rnp->completed; /* if GP in progress... */
|
|
|
9765980 |
- rdp->completed = rnp->completed;
|
|
|
9765980 |
+ /*
|
|
|
9765980 |
+ * If there is a grace period in progress, we will
|
|
|
9765980 |
+ * set up to wait for it next time we run the
|
|
|
9765980 |
+ * RCU core code.
|
|
|
9765980 |
+ */
|
|
|
9765980 |
+ rdp->gpnum = rnp->completed;
|
|
|
9765980 |
+ rdp->completed = rnp->completed;
|
|
|
9765980 |
+ rdp->passed_quiesc = 0;
|
|
|
9765980 |
+ rdp->qs_pending = 0;
|
|
|
9765980 |
rdp->passed_quiesc_completed = rnp->completed - 1;
|
|
|
9765980 |
}
|
|
|
9765980 |
raw_spin_unlock(&rnp->lock); /* irqs already disabled. */
|
|
|
9765980 |
--
|
|
|
9765980 |
1.7.6
|
|
|
9765980 |
|