Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread Andrew Hunter
On Thu, Sep 4, 2014 at 2:36 PM, Paul Turner wrote: > On Thu, Sep 4, 2014 at 2:30 PM, John Stultz wrote: >> This seems to be a quite old bug.. Do you think this is needed for -stable? > > Seems reasonable to me. > I have no opinion: backport or don't at your preference. -- To unsubscribe from

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread Paul Turner
On Thu, Sep 4, 2014 at 2:30 PM, John Stultz wrote: > On Thu, Sep 4, 2014 at 2:17 PM, Andrew Hunter wrote: >> On Wed, Sep 3, 2014 at 5:06 PM, John Stultz wrote: >>> Maybe with the next version of the patch, before you get into the >>> unwinding the math, you might practically describe what is

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread John Stultz
On Thu, Sep 4, 2014 at 2:17 PM, Andrew Hunter wrote: > On Wed, Sep 3, 2014 at 5:06 PM, John Stultz wrote: >> Maybe with the next version of the patch, before you get into the >> unwinding the math, you might practically describe what is broken, >> then explain how its broken. >> >> My quick read

[PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread Andrew Hunter
timeval_to_jiffies tried to round a timeval up to an integral number of jiffies, but the logic for doing so was incorrect: intervals corresponding to exactly N jiffies would become N+1. This manifested itself particularly repeatedly stopping/starting an itimer: setitimer(ITIMER_PROF, , NULL);

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread Andrew Hunter
On Wed, Sep 3, 2014 at 5:06 PM, John Stultz wrote: > Maybe with the next version of the patch, before you get into the > unwinding the math, you might practically describe what is broken, > then explain how its broken. > Done. > My quick read here is that we're converting a timespec -> jiffies,

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread Andrew Hunter
On Wed, Sep 3, 2014 at 5:06 PM, John Stultz john.stu...@linaro.org wrote: Maybe with the next version of the patch, before you get into the unwinding the math, you might practically describe what is broken, then explain how its broken. Done. My quick read here is that we're converting a

[PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread Andrew Hunter
timeval_to_jiffies tried to round a timeval up to an integral number of jiffies, but the logic for doing so was incorrect: intervals corresponding to exactly N jiffies would become N+1. This manifested itself particularly repeatedly stopping/starting an itimer: setitimer(ITIMER_PROF, val, NULL);

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread John Stultz
On Thu, Sep 4, 2014 at 2:17 PM, Andrew Hunter a...@google.com wrote: On Wed, Sep 3, 2014 at 5:06 PM, John Stultz john.stu...@linaro.org wrote: Maybe with the next version of the patch, before you get into the unwinding the math, you might practically describe what is broken, then explain how

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread Paul Turner
On Thu, Sep 4, 2014 at 2:30 PM, John Stultz john.stu...@linaro.org wrote: On Thu, Sep 4, 2014 at 2:17 PM, Andrew Hunter a...@google.com wrote: On Wed, Sep 3, 2014 at 5:06 PM, John Stultz john.stu...@linaro.org wrote: Maybe with the next version of the patch, before you get into the unwinding

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-04 Thread Andrew Hunter
On Thu, Sep 4, 2014 at 2:36 PM, Paul Turner p...@google.com wrote: On Thu, Sep 4, 2014 at 2:30 PM, John Stultz john.stu...@linaro.org wrote: This seems to be a quite old bug.. Do you think this is needed for -stable? Seems reasonable to me. I have no opinion: backport or don't at your

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-03 Thread John Stultz
On Thu, Aug 7, 2014 at 5:09 PM, Andrew Hunter wrote: > timeval_to_jiffies rounding was broken. It essentially computed > (eliding seconds) > > jiffies = usec * (NSEC_PER_USEC/TICK_NSEC) > > by using scaling arithmetic, which took the best approximation of > NSEC_PER_USEC/TICK_NSEC with

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-03 Thread Paul Turner
John -- Any chance to take a look at this? (The dilation is pretty unfortunate when profiling reprograms a timer with it.) On Thu, Aug 7, 2014 at 5:09 PM, Andrew Hunter wrote: > timeval_to_jiffies rounding was broken. It essentially computed > (eliding seconds) > > jiffies = usec *

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-03 Thread Paul Turner
John -- Any chance to take a look at this? (The dilation is pretty unfortunate when profiling reprograms a timer with it.) On Thu, Aug 7, 2014 at 5:09 PM, Andrew Hunter a...@google.com wrote: timeval_to_jiffies rounding was broken. It essentially computed (eliding seconds) jiffies = usec *

Re: [PATCH] sched: fix timeval conversion to jiffies

2014-09-03 Thread John Stultz
On Thu, Aug 7, 2014 at 5:09 PM, Andrew Hunter a...@google.com wrote: timeval_to_jiffies rounding was broken. It essentially computed (eliding seconds) jiffies = usec * (NSEC_PER_USEC/TICK_NSEC) by using scaling arithmetic, which took the best approximation of NSEC_PER_USEC/TICK_NSEC with

[PATCH] sched: fix timeval conversion to jiffies

2014-08-07 Thread Andrew Hunter
timeval_to_jiffies rounding was broken. It essentially computed (eliding seconds) jiffies = usec * (NSEC_PER_USEC/TICK_NSEC) by using scaling arithmetic, which took the best approximation of NSEC_PER_USEC/TICK_NSEC with denominator of 2^USEC_JIFFIE_SC = x/(2^USEC_JIFFIE_SC), and computed:

[PATCH] sched: fix timeval conversion to jiffies

2014-08-07 Thread Andrew Hunter
timeval_to_jiffies rounding was broken. It essentially computed (eliding seconds) jiffies = usec * (NSEC_PER_USEC/TICK_NSEC) by using scaling arithmetic, which took the best approximation of NSEC_PER_USEC/TICK_NSEC with denominator of 2^USEC_JIFFIE_SC = x/(2^USEC_JIFFIE_SC), and computed: