Re: [PATCH] Add an offset in the cyc2ns computation to fixsched_clock jumps

From: john stultz
Date: Fri Mar 16 2007 - 14:26:26 EST


On Fri, 2007-03-16 at 19:14 +0100, Guillaume Chazarain wrote:
> Hello,
>
> The scheduling problems I reported in the thread:
> http://lkml.org/lkml/2007/3/3/128
> are caused by the set_cyc2ns_scale() function called when the CPU speed changes.
> Changing the scale causes a warp in the value returned by sched_clock().
>
> The attached patch fixes the problem by adding an offset to the cyc2ns code to
> smooth CPU frequency transitions. It also makes the cyc2ns parameters
> per-CPU as cpufreq seems to support SMP but I don't have the hardware
> to test. If you want
> a version without the per-CPU or irqsave stuff, just ask.

Oh great! This has been a long standing issue I've never managed to get
around to and your approach to fixing it is simpler then what I was
thinking it would take.

Thanks for knocking this off!

> Although it solved all my scheduler issues, it may not be fully satisfactory
> as for example my TSC can run at a frequency as low as 350 MHz when the CPU is
> idle and slowed down to the max at 798 MHz by ondemand. So in this case,
> sched_clock() does not return nanoseconds as it thinks it does. Hopefully this
> is a non-issue as the scheduler is not stressed when the CPU is idle.

Hmm.. It drops to 350MHz on idle, but only ~800Mhz by on-demand? That
sounds more like the C3 idle TSC halt issue.

> For me, this is needed in 2.6.21 if I want to be able to listen to music while
> compiling a kernel using the ondemand governor.
>
> Thanks.
>
> Signed-off-by: Guillaume Chazarain <guichaz@xxxxxxxx>

Acked-by: John Stultz <johnstul@xxxxxxxxxx>

-
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/