lkml.org 
[lkml]   [2010]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 1/3] sched: init rt_avg stat whenever rq comes online
From
Date
On Mon, 2010-08-16 at 21:25 +0200, Peter Zijlstra wrote:
> You can use something like:
>
> suspend:
> __get_cpu_var(cyc2ns_suspend) = sched_clock();
>
> resume:
> for_each_possible_cpu(i)
> per_cpu(cyc2ns_offset, i) += per_cpu(cyc2ns_suspend);
>
> or something like that to keep sched_clock() stable, which is exactly
> what most (all?) its users expect when we report the TSC is usable.

That's actually broken, you only want a single offset, otherwise we
de-sync the TSC, which is bad.

So simply store the sched_clock() value at suspend time on the single
CPU that is still running, then on resume make sure sched_clock()
continues there by adding that stamp to all CPU offsets.




\
 
 \ /
  Last update: 2010-08-17 10:55    [from the cache]
©2003-2011 Jasper Spaans