Messages in this thread | | | From | "Doug Smythies" <> | Subject | RE: [PATCH] cpufreq: intel_pstate: Fix rounding of core_pct | Date | Fri, 13 Jun 2014 07:36:21 -0700 |
| |
On 2014.06.12 06:49 Dirk Brandewie wrote: > On 06/12/2014 01:03 PM, Rafael J. Wysocki wrote: >> On Thursday, June 12, 2014 05:35:59 PM Stratos Karafotis wrote: >>> On 12/06/2014 12:15 πμ, Doug Smythies wrote:
>>>>> Could you please elaborate a little bit more what we need these 2 lines below? >>>>>
> Sorry for being MIA on this thread I have been up to my eyeballs.
>>>> if ((rem << 1) >= int_tofp(sample->mperf)) >>>> core_pct += 1;
> The rounding should have been > core_pct += (1 << (FRAC_BITS-1)); > Since core_pct is is in fixeded point notation at this point. Adding .5 to > core_pct to round up.
> As Stratos pointed out the the current code only adds 1/256 to core_pct
> Since core_pct_busy stays in fixed point through out the rest of the > calculations ans we only do the rounding when the PID is returning an > int I think we can safely remove these two lines.
Absolutely, no.
That code was doing exactly what I wanted it to do. But, as and I have already admitted, it was overkill, and yes the entire thing can be changed to use div_64 instead.
We do not want to add 1/2 to core percent here at this spot. You would just be bringing back the arbitrary and incorrect biasing of core_pct upwards that used to be there in two spots before.
You would add 1/2 when you want to convert to an integer, not before (and we don't right now, for the call to trace_pstate_sample).
... Doug
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |