summaryrefslogtreecommitdiffstats
path: root/rcu-avoid-just-onlined-cpu-resched.patch
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@redhat.com>2011-08-15 10:06:52 -0400
committerJosh Boyer <jwboyer@redhat.com>2011-08-15 10:06:52 -0400
commit6920e17ebc39b209f18c9fcf8cccf19b3b984560 (patch)
tree0b8caccd4041abb4c068dfe14b6eb9de711e852d /rcu-avoid-just-onlined-cpu-resched.patch
parentf1b16b1fca682d767ea2cc2f91837fd34a4bf577 (diff)
downloadkernel-6920e17ebc39b209f18c9fcf8cccf19b3b984560.tar.gz
kernel-6920e17ebc39b209f18c9fcf8cccf19b3b984560.tar.xz
kernel-6920e17ebc39b209f18c9fcf8cccf19b3b984560.zip
Linux-3.1-rc2
Add better fix from Paul McKenney for rcu scheduling issue (rhbz 726877)
Diffstat (limited to 'rcu-avoid-just-onlined-cpu-resched.patch')
-rw-r--r--rcu-avoid-just-onlined-cpu-resched.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/rcu-avoid-just-onlined-cpu-resched.patch b/rcu-avoid-just-onlined-cpu-resched.patch
new file mode 100644
index 000000000..517f37591
--- /dev/null
+++ b/rcu-avoid-just-onlined-cpu-resched.patch
@@ -0,0 +1,47 @@
+rcu: Avoid having just-onlined CPU resched itself when RCU is idle
+
+CPUs set rdp->qs_pending when coming online to resolve races with
+grace-period start. However, this means that if RCU is idle, the
+just-onlined CPU might needlessly send itself resched IPIs. Adjust
+the online-CPU initialization to avoid this, and also to correctly
+cause the CPU to respond to the current grace period if needed.
+
+Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+---
+ kernel/rcutree.c | 13 +++++++++----
+ 1 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/kernel/rcutree.c b/kernel/rcutree.c
+index ba06207..472d6b2 100644
+--- a/kernel/rcutree.c
++++ b/kernel/rcutree.c
+@@ -1865,8 +1865,6 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptible)
+
+ /* Set up local state, ensuring consistent view of global state. */
+ raw_spin_lock_irqsave(&rnp->lock, flags);
+- rdp->passed_quiesc = 0; /* We could be racing with new GP, */
+- rdp->qs_pending = 1; /* so set up to respond to current GP. */
+ rdp->beenonline = 1; /* We have now been online. */
+ rdp->preemptible = preemptible;
+ rdp->qlen_last_fqs_check = 0;
+@@ -1891,8 +1889,15 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptible)
+ rnp->qsmaskinit |= mask;
+ mask = rnp->grpmask;
+ if (rnp == rdp->mynode) {
+- rdp->gpnum = rnp->completed; /* if GP in progress... */
+- rdp->completed = rnp->completed;
++ /*
++ * If there is a grace period in progress, we will
++ * set up to wait for it next time we run the
++ * RCU core code.
++ */
++ rdp->gpnum = rnp->completed;
++ rdp->completed = rnp->completed;
++ rdp->passed_quiesc = 0;
++ rdp->qs_pending = 0;
+ rdp->passed_quiesc_completed = rnp->completed - 1;
+ }
+ raw_spin_unlock(&rnp->lock); /* irqs already disabled. */
+--
+1.7.6
+