]> Git Repo - linux.git/commit
CPU hotplug, debug: detect imbalance between get_online_cpus() and put_online_cpus()
authorSrivatsa S. Bhat <[email protected]>
Mon, 8 Oct 2012 23:28:20 +0000 (16:28 -0700)
committerLinus Torvalds <[email protected]>
Tue, 9 Oct 2012 07:22:15 +0000 (16:22 +0900)
commit075663d19885eb3738fd2d7dbdb8947e12563b68
tree99454962711f19b24b5b4642b6a95a6551731228
parent7ac57a89de958fbb5271dc504d0c25e34dbeec32
CPU hotplug, debug: detect imbalance between get_online_cpus() and put_online_cpus()

The synchronization between CPU hotplug readers and writers is achieved
by means of refcounting, safeguarded by the cpu_hotplug.lock.

get_online_cpus() increments the refcount, whereas put_online_cpus()
decrements it.  If we ever hit an imbalance between the two, we end up
compromising the guarantees of the hotplug synchronization i.e, for
example, an extra call to put_online_cpus() can end up allowing a
hotplug reader to execute concurrently with a hotplug writer.

So, add a WARN_ON() in put_online_cpus() to detect such cases where the
refcount can go negative, and also attempt to fix it up, so that we can
continue to run.

Signed-off-by: Srivatsa S. Bhat <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/cpu.c
This page took 0.066972 seconds and 4 git commands to generate.