From: Frederic Weisbecker <fweisbec@gmail.com>
To: Andreas Mohr <andi@lisas.de>
Cc: Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Fernando Luis Vazquez Cao <fernando_b1@lab.ntt.co.jp>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH 3/5] timer: Change idle/iowait accounting semantics
Date: Mon, 4 Nov 2013 17:22:55 +0100 [thread overview]
Message-ID: <20131104162253.GG9299@localhost.localdomain> (raw)
In-Reply-To: <20131020073456.GA2729@rhlx01.hs-esslingen.de>
On Sun, Oct 20, 2013 at 09:34:56AM +0200, Andreas Mohr wrote:
> Hi,
>
> just wanted to report that this capricious open-coded (ok, lone-coded :)
> converter:
>
> +static inline ktime_t us_to_ktime(u64 us)
> +{
> + static const ktime_t ktime_zero = { .tv64 = 0 };
> +
> + return ktime_add_us(ktime_zero, us);
> +}
>
> triggered a virtual red flag in my processing.
>
> We obviously seem to be compensating for a domain mismatch here:
>
> + iowait = get_cpu_iowait_time_us(cpu, NULL);
> +
> + if (ktime_compare(idle, us_to_ktime(iowait)) > 0)
> + idle = ktime_sub_us(idle, iowait);
> +
>
> And sure enough:
> get_cpu_iowait_time_us() does a final to-us conversion
> only right before result is returned,
> and it's located right within the same build unit (tick-sched.c).
> (and then we go ahead and do a from-us round trip :-P)
>
> So, in case we want to standardize on ktime_t domain
> for these parts of purely *in-kernel* time handling,
> how about adding a _unit-local_ helper for providing a ktime-only result
> and convert get_cpu_iowait_time_us() into a simple to-us *external user code*
> one-line wrapper for it?
> (and include updates to all other places which would benefit from this change)
Agreed. I admit I worked around this little part because that code is actually
not expected to be merged but was rather posted to raise some questions and may be
answer. But what you're suggesting is definetly the right way.
> And preferably launch such patch as a preparatory patch for this
> subsequent 3/5 patch, within the series?
Yep. Well, I hope we can find another way to fix the initial issue. But if that part of the code
is reused, I'll take care of fixing that.
Thanks!
next prev parent reply other threads:[~2013-11-04 16:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-19 15:17 [RFC PATCH 0/5] nohz: Fix racy sleeptime stats v2 Frederic Weisbecker
2013-10-19 15:17 ` [PATCH 1/5] nohz: Convert a few places to use local per cpu accesses Frederic Weisbecker
2013-10-19 15:17 ` [PATCH 2/5] nohz: Only update sleeptime stats locally Frederic Weisbecker
2013-10-19 15:17 ` [PATCH 3/5] timer: Change idle/iowait accounting semantics Frederic Weisbecker
2013-10-20 7:34 ` Andreas Mohr
2013-11-04 16:22 ` Frederic Weisbecker [this message]
2013-10-19 15:17 ` [PATCH 4/5] sched: Refactor iowait accounting Frederic Weisbecker
2013-10-19 15:35 ` Peter Zijlstra
2013-10-19 16:02 ` Frederic Weisbecker
2013-10-19 16:05 ` Peter Zijlstra
2013-10-19 16:20 ` Frederic Weisbecker
2013-10-20 11:10 ` Andreas Mohr
2013-11-04 17:34 ` Frederic Weisbecker
2013-11-04 18:38 ` Andreas Mohr
2013-10-19 15:17 ` [PATCH 5/5] nohz: Synchronize sleep time stats with seqlock Frederic Weisbecker
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=20131104162253.GG9299@localhost.localdomain \
--to=fweisbec@gmail.com \
--cc=andi@lisas.de \
--cc=fernando_b1@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=peterz@infradead.org \
--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