From: Ingo Molnar <mingo@kernel.org>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Richard Cochran <richardcochran@gmail.com>,
Prarit Bhargava <prarit@redhat.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, 26 Jul 2012 14:57:21 +0200 [thread overview]
Message-ID: <20120726125721.GE24672@gmail.com> (raw)
In-Reply-To: <500DA6A4.1000009@linaro.org>
* John Stultz <john.stultz@linaro.org> wrote:
> On 07/19/2012 02:33 AM, Ingo Molnar wrote:
> >* John Stultz <john.stultz@linaro.org> wrote:
> >
> >>+static void tk_set_sleep_time(struct timekeeper *tk, struct timespec t)
> >>+{
> >>+ /* Verify consistency before modifying */
> >>+ WARN_ON_ONCE(tk->offs_boot.tv64 !=
> >>+ timespec_to_ktime(tk->total_sleep_time).tv64);
> >asserts like this can be put into a single line - we rarely need
> >to read them if they don't trigger - and making them
> >non-intrusive oneliners is a bonus.
>
> Ack.
>
> >> @@ -456,8 +478,8 @@ int timekeeping_inject_offset(struct timespec *ts)
> >> tk_xtime_add(&timekeeper, ts);
> >>- timekeeper.wall_to_monotonic =
> >>- timespec_sub(timekeeper.wall_to_monotonic, *ts);
> >>+ tk_set_wall_to_mono(&timekeeper,
> >>+ timespec_sub(timekeeper.wall_to_monotonic, *ts));
> >There's a *lot* of unnecessary ugliness here and in many other
> >places in kernel/time/ due to repeating patterns of
> >"timekeeper.", which gets repeated many times and blows up line
> >length.
> >
> >Please add this to the highest level (system call, irq handler,
> >etc.) code:
> >
> > struct timekeeper *tk = &timekeeper;
> >
> >and pass that down to lower levels. The tk-> pattern will be the
> >obvious thing to type in typical time handling functions.
> >
> >This increases readability and clarifies the data flow and might
> >bring other advantages in the future.
>
> Sounds good. Are you ok if this is done in a follow-on patch?
Yeah, sure - the code is going in the right direction in
general, so no hurry.
Thanks,
Ingo
next prev parent reply other threads:[~2012-07-26 12:57 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 [this message]
2012-07-19 12:37 ` Prarit Bhargava
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=20120726125721.GE24672@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=prarit@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).