You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
480 B
17 lines
480 B
time: prevent the loop in timespec_add_ns() from being optimised away
|
|
|
|
Since some architectures don't support __udivdi3().
|
|
|
|
--- a/include/linux/time.h
|
|
+++ b/include/linux/time.h
|
|
@@ -170,6 +170,10 @@ static inline void timespec_add_ns(struc
|
|
{
|
|
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++;
|
|
}
|
|
|