lkml.org 
[lkml]   [2008]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: CONFIG_PRINTK_TIME broken on git HEAD ?
Peter Zijlstra wrote:
> On Thu, 2008-05-08 at 13:21 +0200, Gabriel C wrote:
>
>>> Ok, so the issue is that the clock doesn't start at 0, but at:
>>> 4294014.506571 ?
>> At least on my box , yes.
>>
>
> Does this work for you?

No it does not , I still get :

....
[ 0.000000] PERCPU: Allocating 42756 bytes of per cpu data
[ 0.000000] NR_CPUS: 8, nr_cpu_ids: 4
[4294014.506571] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 1010723
...

>
> ---
>
> Subject: sched: fixup sched-clock offset
> From: Peter Zijlstra <a.p.zijlstra@chello.nl>
>
> It could happen that ktime doesn't start at 0.
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
> kernel/sched_clock.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> Index: linux-2.6-2/kernel/sched_clock.c
> ===================================================================
> --- linux-2.6-2.orig/kernel/sched_clock.c
> +++ linux-2.6-2/kernel/sched_clock.c
> @@ -59,21 +59,23 @@ static inline struct sched_clock_data *c
> return &per_cpu(sched_clock_data, cpu);
> }
>
> +static __read_mostly u64 ktime_offset;
> +
> void sched_clock_init(void)
> {
> - u64 ktime_now = ktime_to_ns(ktime_get());
> - u64 now = 0;
> int cpu;
>
> + ktime_offset = ktime_to_ns(ktime_get());
> +
> for_each_possible_cpu(cpu) {
> struct sched_clock_data *scd = cpu_sdc(cpu);
>
> scd->lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
> scd->prev_jiffies = jiffies;
> - scd->prev_raw = now;
> - scd->tick_raw = now;
> - scd->tick_gtod = ktime_now;
> - scd->clock = ktime_now;
> + scd->prev_raw = 0;
> + scd->tick_raw = 0;
> + scd->tick_gtod = 0;
> + scd->clock = 0;
> }
> }
>
> @@ -177,7 +179,7 @@ void sched_clock_tick(void)
> WARN_ON_ONCE(!irqs_disabled());
>
> now = sched_clock();
> - now_gtod = ktime_to_ns(ktime_get());
> + now_gtod = ktime_to_ns(ktime_get()) - ktime_offset;
>
> __raw_spin_lock(&scd->lock);
> __update_sched_clock(scd, now);
>
>
>


\
 
 \ /
  Last update: 2008-05-09 14:17    [from the cache]
©2003-2011 Jasper Spaans