lkml.org 
[lkml]   [2017]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/cputime: Fix using smp_processor_id() in preemptible
On Thu, Jul 06, 2017 at 08:18:41PM -0700, Wanpeng Li wrote:
> --- a/kernel/sched/cputime.c
> +++ b/kernel/sched/cputime.c
> @@ -683,7 +683,7 @@ static u64 vtime_delta(struct vtime *vtime)
> {
> unsigned long long clock;
>
> - clock = sched_clock_cpu(smp_processor_id());
> + clock = sched_clock();
> if (clock < vtime->starttime)
> return 0;
>

This is broken. sched_clock_cpu() and sched_clock() do not have the
exact same value :-/

So this ends up doing:

vtime->starttime = sched_clock_cpu(cpu);

/* ... */

clock = sched_clock();

delta = clock - vtime->starttime;


And you compute a delta using two different clocks.

\
 
 \ /
  Last update: 2017-07-07 10:12    [W:0.029 / U:8.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site