Re: x86: Clean up computation of HPET .mult variables
From: Carlos R. Mafra
Date: Mon May 05 2008 - 22:10:32 EST
On Mon 5.May'08 at 16:58:08 -0700, Daniel Walker wrote:
>
> On Mon, 2008-05-05 at 20:11 -0300, Carlos R. Mafra wrote:
>
> > - tmp = (u64)hpet_period << HPET_SHIFT;
> > - do_div(tmp, FSEC_PER_NSEC);
> > - clocksource_hpet.mult = (u32)tmp;
> > + clocksource_hpet.mult = div_sc(hpet_period, FSEC_PER_NSEC, HPET_SHIFT);
> >
>
> There's helper functions that should be used called clocksource_hz2mult
> and one called clocksource_khz2mult. I think they're more accurate than
> using div_sc.
Ok, but they take the frequency as the input while the "natural" variable
we have is the period, because that's what we get from the hardware (at
least for the HPET, if I understood it correctly).
If I want to use clocksource_hz2mult then I have
to do one more operation (to find the frequency) before calling it (and
that's what the other part of the patch which you didn't quote is
actually doing).
So the savings in my patch is due to using the period directly, and
not the frequency. That's what my idea was, so if you object then
my attempt was a failure and should be forgotten :-)
Or maybe I should create a clocksource_period2mult to replace
clocksource_hz2mult and save the extra operation in more places too?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/