summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2011-05-03 08:40:04 +0200
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2011-05-06 08:16:59 +0200
commitbad6e1393cb505fe17747344a23666464daa3fa7 (patch)
tree521dcada78d0f19400d14547381f0f3b2e38fea2
parentrcu: optimize rcutiny (diff)
downloadlinux-bad6e1393cb505fe17747344a23666464daa3fa7.tar.xz
linux-bad6e1393cb505fe17747344a23666464daa3fa7.zip
rcu: get rid of signed overflow in check_cpu_stall()
Signed integer overflow is undefined by the C standard, so move calculations to unsigned. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--kernel/rcutree.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 78923a50cdb2..b2fe2a273df2 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -581,21 +581,24 @@ static void print_cpu_stall(struct rcu_state *rsp)
static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
{
- long delta;
+ unsigned long j;
+ unsigned long js;
struct rcu_node *rnp;
if (rcu_cpu_stall_suppress)
return;
- delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
+ j = ACCESS_ONCE(jiffies);
+ js = ACCESS_ONCE(rsp->jiffies_stall);
rnp = rdp->mynode;
- if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
+ if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && ULONG_CMP_GE(j, js)) {
/* We haven't checked in, so go dump stack. */
print_cpu_stall(rsp);
- } else if (rcu_gp_in_progress(rsp) && delta >= RCU_STALL_RAT_DELAY) {
+ } else if (rcu_gp_in_progress(rsp) &&
+ ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY)) {
- /* They had two time units to dump stack, so complain. */
+ /* They had a few time units to dump stack, so complain. */
print_other_cpu_stall(rsp);
}
}