[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1442279124-7309-5-git-send-email-john.stultz@linaro.org>
Date: Mon, 14 Sep 2015 18:05:23 -0700
From: John Stultz <john.stultz@...aro.org>
To: LKML <linux-kernel@...r.kernel.org>
Cc: John Stultz <john.stultz@...aro.org>,
Dave Chinner <dchinner@...hat.com>, Tejun Heo <tj@...nel.org>,
Ingo Molnar <mingo@...nel.org>
Subject: [RFC][PATCH 4/5] percpu: Fix abs() usage in percpu_counter_compare()
s64 values should not be used with abs(), as is one
in __percpu_counter_compare(), since it may cap the
result to 32-bits.
This patch modifies __percpu_counter_compare() to
use abs64() instead.
Cc: Dave Chinner <dchinner@...hat.com>
Cc: Tejun Heo <tj@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
lib/percpu_counter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index f051d69..3d1aba9 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -203,7 +203,7 @@ int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch)
count = percpu_counter_read(fbc);
/* Check to see if rough count will be sufficient for comparison */
- if (abs(count - rhs) > (batch * num_online_cpus())) {
+ if (abs64(count - rhs) > (batch * num_online_cpus())) {
if (count > rhs)
return 1;
else
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists