From: Ingo Molnar <mingo@kernel.org>
To: John Stultz <john.stultz@linaro.org>
Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>,
lkml <linux-kernel@vger.kernel.org>,
jstancek@redhat.com
Subject: Re: time / gtod seconds value out of sync?
Date: Thu, 19 Feb 2015 20:16:01 +0100 [thread overview]
Message-ID: <20150219191601.GA12224@gmail.com> (raw)
In-Reply-To: <CALAqxLX7fBcHUpkJyZHy62v-9ynG3b7Uqnw1o--7CvJ9=LEtEQ@mail.gmail.com>
* John Stultz <john.stultz@linaro.org> wrote:
> > [ 313.001823] NACC: timekeeping_get_ns = 1000121642
> > [ 314.001889] NACC: timekeeping_get_ns = 188401
> >
> > gtod correctly accumulates those nsecs into the secs value:
> >
> > ts->tv_sec = tk->xtime_sec;
> > nsecs = timekeeping_get_ns(&tk->tkr);
> > ts->tv_nsec = 0;
> > timespec64_add_ns(ts, nsecs);
> >
> > but time() does:
> >
> > return tk->xtime_sec;
> >
> > It seems like overkill to do the full timekeeping_get_ns() in time(),
>
> Right, so looking into the git history,
> f20bf6125605acbbc7eb8c9420d7221c91aa83eb (time: introduce
> xtime_seconds) changed this specifically for performance
> reasons (cc'ed Ingo here, in case he remembers more
> context).
>
> The idea that time() would be ok as being HZ granular,
> and its been this way since 2.6.23. Thus you have a < HZ
> sized window where gettimeofday() will return the next
> second before time() gets updated by the tick.
Yes, and the scalability advantage is significant if you
have an app that calls time() often. Undoing that would
certainly make me sad.
Thanks,
Ingo
next prev parent reply other threads:[~2015-02-19 19:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-19 18:35 time / gtod seconds value out of sync? Nishanth Aravamudan
2015-02-19 19:03 ` John Stultz
2015-02-19 19:16 ` Ingo Molnar [this message]
2015-02-19 19:28 ` Nishanth Aravamudan
2015-02-20 13:31 ` Jan Stancek
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=20150219191601.GA12224@gmail.com \
--to=mingo@kernel.org \
--cc=john.stultz@linaro.org \
--cc=jstancek@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nacc@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox