On 11/27/2015 01:49 PM, Paolo Bonzini wrote:
On 27/11/2015 09:12, Roman Kagan wrote:
+ n = div64_u64(time_now - stimer->exp_time, stimer->count) + 1;
+ stimer->exp_time += n * stimer->count;
This is actually just a reminder calculation so I'd rather do it
directly with div64_u64_rem().
It took me a while to understand why it was a remained. :) Expanding
Andrey's formula you get
exp_time = exp_time + count + (time_now - exp_time) / count * count
the remainder, (time_now - exp_time) % count would be
time_now - exp_time - (time_now - exp_time) / count * count
so -((time_now - exp_time) % count) is
exp_time - time_now + (time_now - exp_time) / count * count
so Andrey's expression is
exp_time = time_now + (count - (time_now - exp_time) % count)
Yeah, that looks nice.
I'll redo this way.
Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html