[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANRm+CxS6y7RNSO4Zts_S1rD32kbnAozhvfYHkJjp-B0N5Dqtw@mail.gmail.com>
Date: Wed, 29 Mar 2017 17:56:30 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Luiz Capitulino <lcapitulino@...hat.com>
Cc: Rik van Riel <riel@...hat.com>,
Frederic Weisbecker <fweisbec@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [BUG nohz]: wrong user and system time accounting
2017-03-29 5:26 GMT+08:00 Luiz Capitulino <lcapitulino@...hat.com>:
> On Tue, 28 Mar 2017 17:01:52 -0400
> Rik van Riel <riel@...hat.com> wrote:
>
>> On Tue, 2017-03-28 at 16:14 -0400, Luiz Capitulino wrote:
>> > On Tue, 28 Mar 2017 13:24:06 -0400
>> > Luiz Capitulino <lcapitulino@...hat.com> wrote:
>> > > I'm starting to suspect that the nohz code may be programming
>> > > the tick period to be shorter than 1ms when it re-activates
>> > > the tick.
>> >
>> > And I think I was right, it looks like the nohz code is programming
>> > the tick period incorrectly when restarting the tick. The patch below
>> > fixes things for me, but I still have some homework todo and more
>> > testing before posting a patch for inclusion. Could you guys test it?
>>
>> Your patch seems to work. I don't claim to understand why
>> your patch makes a difference, but for this particular test
>> case, on this particular setup, it seems to work...
>
> I don't fully understand why either yet. I was looking for places
> where nohz might be programming the tick period incorrectly and
The bug is still present when I config CONTEXT_TRACKING_FORCE and
nohz=off in the boot parameter.
Regards,
Wanpeng Li
> I found that there's a case in tick_nohz_stop_sched_tick() where
> tick_nohz_restart() is called only to reprogram the tick timer,
> not cancel the tick. In this case, ts->last_tick seems to be out
> of date. Fixing this fixed accounting for me.
>
>> > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
>> > index 7fe53be..9abe979 100644
>> > --- a/kernel/time/tick-sched.c
>> > +++ b/kernel/time/tick-sched.c
>> > @@ -1152,6 +1152,7 @@ static enum hrtimer_restart
>> > tick_sched_timer(struct hrtimer *timer)
>> > struct pt_regs *regs = get_irq_regs();
>> > ktime_t now = ktime_get();
>> >
>> > + ts->last_tick = now;
>> > tick_sched_do_timer(now);
>> >
>> > /*
>>
>
Powered by blists - more mailing lists