From ad10112e88315deab0db5f3e2823941d2ffc291e Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Tue, 4 Mar 2008 14:59:54 -0800 Subject: [PATCH] --- yaml --- r: 87064 b: refs/heads/master c: 38332cb98772f5ea757e6486bed7ed0381cb5f98 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/time.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 5a68ee521961..44369f2f7df6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e48af19f56eb47a1f908ee8f16df9d246f955b21 +refs/heads/master: 38332cb98772f5ea757e6486bed7ed0381cb5f98 diff --git a/trunk/include/linux/time.h b/trunk/include/linux/time.h index 2091a19f1655..d32ef0ad4c0a 100644 --- a/trunk/include/linux/time.h +++ b/trunk/include/linux/time.h @@ -174,6 +174,10 @@ static inline void timespec_add_ns(struct timespec *a, u64 ns) { ns += a->tv_nsec; while(unlikely(ns >= NSEC_PER_SEC)) { + /* The following asm() prevents the compiler from + * optimising this loop into a modulo operation. */ + asm("" : "+r"(ns)); + ns -= NSEC_PER_SEC; a->tv_sec++; }