[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1491489361.8850.151.camel@redhat.com>
Date: Thu, 06 Apr 2017 10:36:01 -0400
From: Rik van Riel <riel@...hat.com>
To: Wanpeng Li <kernellwp@...il.com>, linux-kernel@...r.kernel.org
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Wanpeng Li <wanpeng.li@...mail.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Mike Galbraith <efault@....de>,
Luiz Capitulino <lcapitulino@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] tick/nohz: Fix wrong user and system time accouting
against vtime sampling
On Wed, 2017-04-05 at 23:36 -0700, Wanpeng Li wrote:
> This patch offsets the tick to avert all ticks alignment in order
> that the vtime sampling does not end up "in phase" with the jiffies
> incrementing.
>
> Reported-by: Luiz Capitulino <lcapitulino@...hat.com>
> Suggested-by: Rik van Riel <riel@...hat.com>
> Cc: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Rik van Riel <riel@...hat.com>
> Cc: Mike Galbraith <efault@....de>
> Cc: Luiz Capitulino <lcapitulino@...hat.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Wanpeng Li <wanpeng.li@...mail.com>
Reviewed-by: Rik van Riel <riel@...hat.com>
> +++ b/kernel/time/tick-sched.c
> @@ -1197,8 +1197,12 @@ void tick_setup_sched_timer(void)
> /* Get the next period (per-CPU) */
> hrtimer_set_expires(&ts->sched_timer,
> tick_init_jiffy_update());
>
> - /* Offset the tick to avert jiffies_lock contention. */
> - if (sched_skew_tick) {
> + /*
> + * 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.
> + */
I feel like part of the explanation is missing from this
comment, but I am not sure how to make it better without
making it way too long :)
> + 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();
Powered by blists - more mailing lists