diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-08-14 18:56:54 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-09-29 00:38:42 -0400 |
commit | 06ae115a1d551cd952d80df06eaf8b5153351875 (patch) | |
tree | 858163c4983a7cc92bffab2267597f3bb802071b /kernel/rcutree.c | |
parent | 9bc8b5586f94be6391458074ecbba8827ba8ba9d (diff) |
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>
Tested-by: Josh Boyer <jwboyer@redhat.com>
Tested-by: Christian Hoffmann <email@christianhoffmann.info>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index ade788320dd6..c95fa89ffef9 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -1911,8 +1911,6 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptible) | |||
1911 | 1911 | ||
1912 | /* Set up local state, ensuring consistent view of global state. */ | 1912 | /* Set up local state, ensuring consistent view of global state. */ |
1913 | raw_spin_lock_irqsave(&rnp->lock, flags); | 1913 | raw_spin_lock_irqsave(&rnp->lock, flags); |
1914 | rdp->passed_quiesce = 0; /* We could be racing with new GP, */ | ||
1915 | rdp->qs_pending = 1; /* so set up to respond to current GP. */ | ||
1916 | rdp->beenonline = 1; /* We have now been online. */ | 1914 | rdp->beenonline = 1; /* We have now been online. */ |
1917 | rdp->preemptible = preemptible; | 1915 | rdp->preemptible = preemptible; |
1918 | rdp->qlen_last_fqs_check = 0; | 1916 | rdp->qlen_last_fqs_check = 0; |
@@ -1937,8 +1935,15 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptible) | |||
1937 | rnp->qsmaskinit |= mask; | 1935 | rnp->qsmaskinit |= mask; |
1938 | mask = rnp->grpmask; | 1936 | mask = rnp->grpmask; |
1939 | if (rnp == rdp->mynode) { | 1937 | if (rnp == rdp->mynode) { |
1940 | rdp->gpnum = rnp->completed; /* if GP in progress... */ | 1938 | /* |
1939 | * If there is a grace period in progress, we will | ||
1940 | * set up to wait for it next time we run the | ||
1941 | * RCU core code. | ||
1942 | */ | ||
1943 | rdp->gpnum = rnp->completed; | ||
1941 | rdp->completed = rnp->completed; | 1944 | rdp->completed = rnp->completed; |
1945 | rdp->passed_quiesce = 0; | ||
1946 | rdp->qs_pending = 0; | ||
1942 | rdp->passed_quiesce_gpnum = rnp->gpnum - 1; | 1947 | rdp->passed_quiesce_gpnum = rnp->gpnum - 1; |
1943 | trace_rcu_grace_period(rsp->name, rdp->gpnum, "cpuonl"); | 1948 | trace_rcu_grace_period(rsp->name, rdp->gpnum, "cpuonl"); |
1944 | } | 1949 | } |