mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 01:34:00 +08:00
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>
This commit is contained in:
parent
e48af19f56
commit
38332cb987
@ -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++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user