aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2006-03-24 06:18:10 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:26 -0500
commit8a14342683b1e3adcf5f78660a42fcbd95b44a35 (patch)
tree332265cb9fe8b1e107864cdb380bf5f6b4bfb840
parent2ecb9e633c5057d1203a59ef3e5c3aaea37c402e (diff)
[PATCH] HOTPLUG_CPU: avoid hitting too many cachelines in recalc_bh_state()
Instead of using for_each_cpu(i), we can use for_each_online_cpu(i). When a CPU goes offline (ie removed from online map), it might have a non null bh_accounting.nr, so this patch adds a transfer of this counter to an online CPU counter. We already have a hotcpu_notifier, (function buffer_cpu_notify()), where we can do this bh_accounting. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/buffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 36c7253bea72..11ca6eb46a33 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3078,7 +3078,7 @@ static void recalc_bh_state(void)
3078 if (__get_cpu_var(bh_accounting).ratelimit++ < 4096) 3078 if (__get_cpu_var(bh_accounting).ratelimit++ < 4096)
3079 return; 3079 return;
3080 __get_cpu_var(bh_accounting).ratelimit = 0; 3080 __get_cpu_var(bh_accounting).ratelimit = 0;
3081 for_each_cpu(i) 3081 for_each_online_cpu(i)
3082 tot += per_cpu(bh_accounting, i).nr; 3082 tot += per_cpu(bh_accounting, i).nr;
3083 buffer_heads_over_limit = (tot > max_buffer_heads); 3083 buffer_heads_over_limit = (tot > max_buffer_heads);
3084} 3084}
@@ -3127,6 +3127,9 @@ static void buffer_exit_cpu(int cpu)
3127 brelse(b->bhs[i]); 3127 brelse(b->bhs[i]);
3128 b->bhs[i] = NULL; 3128 b->bhs[i] = NULL;
3129 } 3129 }
3130 get_cpu_var(bh_accounting).nr += per_cpu(bh_accounting, cpu).nr;
3131 per_cpu(bh_accounting, cpu).nr = 0;
3132 put_cpu_var(bh_accounting);
3130} 3133}
3131 3134
3132static int buffer_cpu_notify(struct notifier_block *self, 3135static int buffer_cpu_notify(struct notifier_block *self,