Commit 8a143426 authored by Eric Dumazet's avatar Eric Dumazet Committed by Linus Torvalds
Browse files

[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, 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: default avatarEric Dumazet <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 2ecb9e63
......@@ -3078,7 +3078,7 @@ static void recalc_bh_state(void)
if (__get_cpu_var(bh_accounting).ratelimit++ < 4096)
__get_cpu_var(bh_accounting).ratelimit = 0;
tot += per_cpu(bh_accounting, i).nr;
buffer_heads_over_limit = (tot > max_buffer_heads);
......@@ -3127,6 +3127,9 @@ static void buffer_exit_cpu(int cpu)
b->bhs[i] = NULL;
get_cpu_var(bh_accounting).nr += per_cpu(bh_accounting, cpu).nr;
per_cpu(bh_accounting, cpu).nr = 0;
static int buffer_cpu_notify(struct notifier_block *self,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment