All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Richard Cochran <richardcochran@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 2/2] time: Cleanup offs_real/wall_to_mono and offs_boot/total_sleep_time updates
Date: Thu, 19 Jul 2012 08:37:00 -0400	[thread overview]
Message-ID: <5007FF6C.3060302@redhat.com> (raw)
In-Reply-To: <1342660753-10382-3-git-send-email-john.stultz@linaro.org>



On 07/18/2012 09:19 PM, John Stultz wrote:
> For performance reasons, we maintain ktime_t based duplicates of
> wall_to_monotonic (offs_real) and total_sleep_time (offs_boot).
> 
> Since large problems could occur (such as the resume regression
> on 3.5-rc7, or the leapsecond hrtimer issue) if these value pairs
> were to be inconsistently updated, this patch this cleans up how
> we modify these value pairs to ensure we are always consistent.
> 
> As a side-effect this is also more efficient as we only
> caulculate the duplicate values when they are changed,
> rather then every update_wall_time call.
> 
> This also provides WARN_ONs to detect if future changes break
> the invariants.
> 
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Prarit Bhargava <prarit@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: John Stultz <john.stultz@linaro.org>

<snip>

> @@ -1024,11 +1041,18 @@ static inline void accumulate_nsecs_to_secs(struct timekeeper *tk)
>  
>  		/* Figure out if its a leap sec and apply if needed */
>  		leap = second_overflow(tk->xtime_sec);
> -		tk->xtime_sec += leap;
> -		tk->wall_to_monotonic.tv_sec -= leap;
> -		if (leap)
> -			clock_was_set_delayed();
> +		if (unlikely(leap)) {

I'm likely a bit behind the times with this comment ...

I thought someone did a comparison of the usage of unlikely() within the kernel
and found that it didn't really add that much.  I'm not strongly opposed to it
in anyway, it is just that I'm curious about unlikely()'s continued usage within
the kernel; does it really add anything *other* than code readability at this point?

> +			struct timespec ts;
> +
> +			tk->xtime_sec += leap;
>  
> +			ts.tv_sec = leap;
> +			ts.tv_nsec = 0;

I wonder if this is true or not when the kernel handles the leap second.  I
suppose, in theory it is ... but it might be ahead by a bit.  I guess it is
"close enough" ;)

> +			tk_set_wall_to_mono(tk,
> +				timespec_sub(tk->wall_to_monotonic, ts));
> +
> +			clock_was_set_delayed();
> +		}
>  	}
>  }
>  

      parent reply	other threads:[~2012-07-19 12:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19  1:19 [PATCH 0/2] Additional time changes for 3.6 John Stultz
2012-07-19  1:19 ` [PATCH 1/2] jiffies: Allow CLOCK_TICK_RATE to be undefined John Stultz
2012-07-19  9:37   ` Ingo Molnar
2012-07-23 19:37     ` John Stultz
2012-07-26 12:56       ` Ingo Molnar
2012-07-19  1:19 ` [PATCH 2/2] time: Cleanup offs_real/wall_to_mono and offs_boot/total_sleep_time updates John Stultz
2012-07-19  9:33   ` Ingo Molnar
2012-07-23 19:31     ` John Stultz
2012-07-26 12:57       ` Ingo Molnar
2012-07-19 12:37   ` Prarit Bhargava [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5007FF6C.3060302@redhat.com \
    --to=prarit@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.