Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1210700
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock |
| Date | 2015-08-20 21:40 +0200 |
| Message-ID | <pZDQS-5Z9-33@gated-at.bofh.it> (permalink) |
| References | <pRks2-4ju-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 29 Jul 2015, Adrian Hunter wrote:
> @@ -239,6 +239,8 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
> unsigned long long tsc_now, ns_now;
> struct cyc2ns_data *data;
> unsigned long flags;
> + u64 mult;
> + u32 shft = 32;
>
> local_irq_save(flags);
> sched_clock_idle_sleep_event();
> @@ -256,12 +258,17 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
> * time function is continuous; see the comment near struct
> * cyc2ns_data.
> */
> - data->cyc2ns_mul =
> - DIV_ROUND_CLOSEST(NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR,
> - cpu_khz);
> - data->cyc2ns_shift = CYC2NS_SCALE_FACTOR;
> + mult = (u64)NSEC_PER_MSEC << 32;
> + mult += cpu_khz / 2;
> + do_div(mult, cpu_khz);
> + while (mult > U32_MAX) {
> + mult >>= 1;
> + shft -= 1;
> + }
This is an open coded variant of clocks_calc_mult_shift(). Can we
please use that one?
Thanks,
tglx
--
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/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock Thomas Gleixner <tglx@linutronix.de> - 2015-08-20 21:40 +0200
Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock Adrian Hunter <adrian.hunter@intel.com> - 2015-08-21 08:50 +0200
[PATCH V3] perf: x86: Improve accuracy of perf/sched clock Adrian Hunter <adrian.hunter@intel.com> - 2015-08-21 11:10 +0200
Re: [PATCH V3] perf: x86: Improve accuracy of perf/sched clock Adrian Hunter <adrian.hunter@intel.com> - 2015-09-01 10:40 +0200
Re: [PATCH V3] perf: x86: Improve accuracy of perf/sched clock Peter Zijlstra <peterz@infradead.org> - 2015-09-01 11:00 +0200
csiph-web