Message ID | 1476998490-4481-1-git-send-email-dianders@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, 20 Oct 2016, Douglas Anderson wrote: Please wait for a full review and do not send out patches 5 seconds after the first mail hits your inbox. Thanks, tglx
Hi, On Thu, Oct 20, 2016 at 2:27 PM, Thomas Gleixner <tglx@linutronix.de> wrote: > On Thu, 20 Oct 2016, Douglas Anderson wrote: > > Please wait for a full review and do not send out patches 5 seconds after > the first mail hits your inbox. Since you had previously commented on patch 1 and had already commented on patch 2, I presumed you were done reviewing, but I was obviously in error. My apologies. -Doug
On Thu, 20 Oct 2016, Doug Anderson wrote: > On Thu, Oct 20, 2016 at 2:27 PM, Thomas Gleixner <tglx@linutronix.de> wrote: > > On Thu, 20 Oct 2016, Douglas Anderson wrote: > > > > Please wait for a full review and do not send out patches 5 seconds after > > the first mail hits your inbox. > > Since you had previously commented on patch 1 and had already > commented on patch 2, I presumed you were done reviewing, but I was > obviously in error. My apologies. No problem. As a general rule you should not send updates like a machine gun. That issue is years old, so there is no rush to fix it just because some random (probably out of tree) code trips over it. Thanks, tglx
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 32bf6f75a8fe..219439efd56a 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1898,12 +1898,28 @@ EXPORT_SYMBOL(msleep_interruptible); static void __sched do_usleep_range(unsigned long min, unsigned long max) { + ktime_t now, end; ktime_t kmin; u64 delta; + int ret; - kmin = ktime_set(0, min * NSEC_PER_USEC); + now = ktime_get(); + end = ktime_add_us(now, min); delta = (u64)(max - min) * NSEC_PER_USEC; - schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL); + do { + kmin = ktime_sub(end, now); + ret = schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL); + + /* + * If schedule_hrtimeout_range() returns 0 then we actually + * hit the timeout. If not then we need to re-calculate the + * new timeout ourselves. + */ + if (ret == 0) + break; + + now = ktime_get(); + } while (ktime_before(now, end)); } /**