cpu: Avoid puts_pending overflow
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 22 Oct 2014 21:51:49 +0000 (14:51 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 4 Nov 2014 03:21:01 +0000 (19:21 -0800)
A long string of get_online_cpus() with each followed by a
put_online_cpu() that fails to acquire cpu_hotplug.lock can result in
overflow of the cpu_hotplug.puts_pending counter.  Although this is
perhaps improbably, a system with absolutely no CPU-hotplug operations
will have an arbitrarily long time in which this overflow could occur.
This commit therefore adds overflow checks to get_online_cpus() and
try_get_online_cpus().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>
kernel/cpu.c

diff --cc kernel/cpu.c
Simple merge