[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANRm+Cz8xj8XkJF1UrxA4zoBt5bx8NURujfU2+Gs_S_i8f4mUQ@mail.gmail.com>
Date: Tue, 11 Apr 2017 05:51:27 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Wanpeng Li <wanpeng.li@...mail.com>,
Rik van Riel <riel@...hat.com>,
Mike Galbraith <efault@....de>,
Luiz Capitulino <lcapitulino@...hat.com>
Subject: Re: [PATCH] tick/nohz: Fix wrong user and system time accouting
against vtime sampling
2017-04-11 2:01 GMT+08:00 Frederic Weisbecker <fweisbec@...il.com>:
> On Mon, Apr 10, 2017 at 05:45:56PM +0200, Thomas Gleixner wrote:
>> On Wed, 5 Apr 2017, Wanpeng Li wrote:
>> > + /*
>> > + * Offset the tick to avert jiffies_lock contention, and all ticks
>> > + * alignment in order that the vtime sampling does not end up "in
>> > + * phase" with the jiffies incrementing.
>> > + */
>> > + if (sched_skew_tick || tick_nohz_full_enabled()) {
>> > u64 offset = ktime_to_ns(tick_period) >> 1;
>> > do_div(offset, num_possible_cpus());
>> > offset *= smp_processor_id();
>>
>> That's not a fix, that's just papering over the problem.
>>
>> offset = 1ms / 2 = 500us = 500000ns;
>> offset /= 144 = 3472ns
>>
>> So CPU0 and CPU1 ticks are ~3 microseconds apart. That merily reduces the
>> probability of the issue, but does not prevent it.
>
> I worried about it but didn't realize it could be that tight.
>
> So the alternative is the solution involving sched_clock() as the source for
> cputime. Wanpeng Li could you please resubmit your patch that does that?
Yeah, I will try it.
Regards,
Wanpeng Li
Powered by blists - more mailing lists