rcu: Eliminate signed overflow in synchronize_rcu_expedited()
authorPaul E. McKenney <paul.mckenney@linaro.org>
Mon, 23 Jul 2012 23:03:51 +0000 (16:03 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Sun, 23 Sep 2012 14:41:56 +0000 (07:41 -0700)
commitbcfa57ce10d3d53d37a6e324f3010b1ce6a2784a
tree1d365a7a64e3ea1d1dc743afcc1de4b6935caa57
parent25d30cf4250f74e5ceb35f8f39739782408db633
rcu: Eliminate signed overflow in synchronize_rcu_expedited()

In the C language, signed overflow is undefined.  It is true that
twos-complement arithmetic normally comes to the rescue, but if the
compiler can subvert this any time it has any information about the values
being compared.  For example, given "if (a - b > 0)", if the compiler
has enough information to realize that (for example) the value of "a"
is positive and that of "b" is negative, the compiler is within its
rights to optimize to a simple "if (1)", which might not be what you want.

This commit therefore converts synchronize_rcu_expedited()'s work-done
detection counter from signed to unsigned.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
kernel/rcutree_plugin.h