diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2008-03-04 17:59:54 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-09-16 15:19:16 -0400 |
commit | cc4319890a80190d3290f1e04886d0384969b5f3 (patch) | |
tree | 6f5ccdd5a5ccf6ed755e1b4dd3798c4af503f363 | |
parent | 85396eb1ff28d4af26fd02c78fd7582cc5de6050 (diff) |
time: prevent the loop in timespec_add_ns() from being optimised away
Since some architectures don't support __udivdi3().
Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/time.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index b04136d60a..3e8fd9e57e 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -173,6 +173,10 @@ static inline void timespec_add_ns(struct timespec *a, u64 ns) | |||
173 | { | 173 | { |
174 | ns += a->tv_nsec; | 174 | ns += a->tv_nsec; |
175 | while(unlikely(ns >= NSEC_PER_SEC)) { | 175 | while(unlikely(ns >= NSEC_PER_SEC)) { |
176 | /* The following asm() prevents the compiler from | ||
177 | * optimising this loop into a modulo operation. */ | ||
178 | asm("" : "+r"(ns)); | ||
179 | |||
176 | ns -= NSEC_PER_SEC; | 180 | ns -= NSEC_PER_SEC; |
177 | a->tv_sec++; | 181 | a->tv_sec++; |
178 | } | 182 | } |