Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1618074

Re: [PATCH] tick/nohz: Fix wrong user and system time accouting against vtime sampling

From Rik van Riel <riel@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tick/nohz: Fix wrong user and system time accouting against vtime sampling
Date 2017-04-06 16:40 +0200
Message-ID <ttgJQ-1sw-11@gated-at.bofh.it> (permalink)
References <tt9fk-4TG-1@gated-at.bofh.it>
Organization Red Hat, Inc

Show all headers | View raw


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@redhat.com>
> Suggested-by: Rik van Riel <riel@redhat.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Luiz Capitulino <lcapitulino@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>

Reviewed-by: Rik van Riel <riel@redhat.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();

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] tick/nohz: Fix wrong user and system time accouting against vtime sampling Wanpeng Li <kernellwp@gmail.com> - 2017-04-06 08:40 +0200
  Re: [PATCH] tick/nohz: Fix wrong user and system time accouting  against vtime sampling Rik van Riel <riel@redhat.com> - 2017-04-06 16:40 +0200
  Re: [PATCH] tick/nohz: Fix wrong user and system time accouting  against vtime sampling Luiz Capitulino <lcapitulino@redhat.com> - 2017-04-07 19:00 +0200

csiph-web