diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-04-14 00:31:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-14 05:31:50 -0400 |
commit | ef631b0ca01655d24e9ca7e199262c4a46416a26 (patch) | |
tree | 0ef86d5b97c6e2de500e639ebb92da8f2ec8c863 /kernel/rcutree_trace.c | |
parent | 27b19565fe4ca5b0e9d2ae98ce4b81ca728bf445 (diff) |
rcu: Make hierarchical RCU less IPI-happy
This patch fixes a hierarchical-RCU performance bug located by Anton
Blanchard. The problem stems from a misguided attempt to provide a
work-around for jiffies-counter failure. This work-around uses a per-CPU
n_rcu_pending counter, which is incremented on each call to rcu_pending(),
which in turn is called from each scheduling-clock interrupt. Each CPU
then treats this counter as a surrogate for the jiffies counter, so
that if the jiffies counter fails to advance, the per-CPU n_rcu_pending
counter will cause RCU to invoke force_quiescent_state(), which in turn
will (among other things) send resched IPIs to CPUs that have thus far
failed to pass through an RCU quiescent state.
Unfortunately, each CPU resets only its own counter after sending a
batch of IPIs. This means that the other CPUs will also (needlessly)
send -another- round of IPIs, for a full N-squared set of IPIs in the
worst case every three scheduler-clock ticks until the grace period
finally ends. It is not reasonable for a given CPU to reset each and
every n_rcu_pending for all the other CPUs, so this patch instead simply
disables the jiffies-counter "training wheels", thus eliminating the
excessive IPIs.
Note that the jiffies-counter IPIs do not have this problem due to
the fact that the jiffies counter is global, so that the CPU sending
the IPIs can easily reset things, thus preventing the other CPUs from
sending redundant IPIs.
Note also that the n_rcu_pending counter remains, as it will continue to
be used for tracing. It may also see use to update the jiffies counter,
should an appropriate kick-the-jiffies-counter API appear.
Located-by: Anton Blanchard <anton@au1.ibm.com>
Tested-by: Anton Blanchard <anton@au1.ibm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: anton@samba.org
Cc: akpm@linux-foundation.org
Cc: dipankar@in.ibm.com
Cc: manfred@colorfullife.com
Cc: cl@linux-foundation.org
Cc: josht@linux.vnet.ibm.com
Cc: schamp@sgi.com
Cc: niv@us.ibm.com
Cc: dvhltc@us.ibm.com
Cc: ego@in.ibm.com
Cc: laijs@cn.fujitsu.com
Cc: rostedt@goodmis.org
Cc: peterz@infradead.org
Cc: penberg@cs.helsinki.fi
Cc: andi@firstfloor.org
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
LKML-Reference: <12396834793575-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutree_trace.c')
-rw-r--r-- | kernel/rcutree_trace.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/kernel/rcutree_trace.c b/kernel/rcutree_trace.c index 4ee954f6a8d5..4b1875ba9404 100644 --- a/kernel/rcutree_trace.c +++ b/kernel/rcutree_trace.c | |||
@@ -49,14 +49,12 @@ static void print_one_rcu_data(struct seq_file *m, struct rcu_data *rdp) | |||
49 | { | 49 | { |
50 | if (!rdp->beenonline) | 50 | if (!rdp->beenonline) |
51 | return; | 51 | return; |
52 | seq_printf(m, "%3d%cc=%ld g=%ld pq=%d pqc=%ld qp=%d rpfq=%ld rp=%x", | 52 | seq_printf(m, "%3d%cc=%ld g=%ld pq=%d pqc=%ld qp=%d", |
53 | rdp->cpu, | 53 | rdp->cpu, |
54 | cpu_is_offline(rdp->cpu) ? '!' : ' ', | 54 | cpu_is_offline(rdp->cpu) ? '!' : ' ', |
55 | rdp->completed, rdp->gpnum, | 55 | rdp->completed, rdp->gpnum, |
56 | rdp->passed_quiesc, rdp->passed_quiesc_completed, | 56 | rdp->passed_quiesc, rdp->passed_quiesc_completed, |
57 | rdp->qs_pending, | 57 | rdp->qs_pending); |
58 | rdp->n_rcu_pending_force_qs - rdp->n_rcu_pending, | ||
59 | (int)(rdp->n_rcu_pending & 0xffff)); | ||
60 | #ifdef CONFIG_NO_HZ | 58 | #ifdef CONFIG_NO_HZ |
61 | seq_printf(m, " dt=%d/%d dn=%d df=%lu", | 59 | seq_printf(m, " dt=%d/%d dn=%d df=%lu", |
62 | rdp->dynticks->dynticks, | 60 | rdp->dynticks->dynticks, |
@@ -102,14 +100,12 @@ static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp) | |||
102 | { | 100 | { |
103 | if (!rdp->beenonline) | 101 | if (!rdp->beenonline) |
104 | return; | 102 | return; |
105 | seq_printf(m, "%d,%s,%ld,%ld,%d,%ld,%d,%ld,%ld", | 103 | seq_printf(m, "%d,%s,%ld,%ld,%d,%ld,%d", |
106 | rdp->cpu, | 104 | rdp->cpu, |
107 | cpu_is_offline(rdp->cpu) ? "\"Y\"" : "\"N\"", | 105 | cpu_is_offline(rdp->cpu) ? "\"Y\"" : "\"N\"", |
108 | rdp->completed, rdp->gpnum, | 106 | rdp->completed, rdp->gpnum, |
109 | rdp->passed_quiesc, rdp->passed_quiesc_completed, | 107 | rdp->passed_quiesc, rdp->passed_quiesc_completed, |
110 | rdp->qs_pending, | 108 | rdp->qs_pending); |
111 | rdp->n_rcu_pending_force_qs - rdp->n_rcu_pending, | ||
112 | rdp->n_rcu_pending); | ||
113 | #ifdef CONFIG_NO_HZ | 109 | #ifdef CONFIG_NO_HZ |
114 | seq_printf(m, ",%d,%d,%d,%lu", | 110 | seq_printf(m, ",%d,%d,%d,%lu", |
115 | rdp->dynticks->dynticks, | 111 | rdp->dynticks->dynticks, |
@@ -123,7 +119,7 @@ static void print_one_rcu_data_csv(struct seq_file *m, struct rcu_data *rdp) | |||
123 | 119 | ||
124 | static int show_rcudata_csv(struct seq_file *m, void *unused) | 120 | static int show_rcudata_csv(struct seq_file *m, void *unused) |
125 | { | 121 | { |
126 | seq_puts(m, "\"CPU\",\"Online?\",\"c\",\"g\",\"pq\",\"pqc\",\"pq\",\"rpfq\",\"rp\","); | 122 | seq_puts(m, "\"CPU\",\"Online?\",\"c\",\"g\",\"pq\",\"pqc\",\"pq\","); |
127 | #ifdef CONFIG_NO_HZ | 123 | #ifdef CONFIG_NO_HZ |
128 | seq_puts(m, "\"dt\",\"dt nesting\",\"dn\",\"df\","); | 124 | seq_puts(m, "\"dt\",\"dt nesting\",\"dn\",\"df\","); |
129 | #endif /* #ifdef CONFIG_NO_HZ */ | 125 | #endif /* #ifdef CONFIG_NO_HZ */ |