From: Andreas Mohr <andi@lisas.de>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
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: Sun, 20 Oct 2013 09:34:56 +0200 [thread overview]
Message-ID: <20131020073456.GA2729@rhlx01.hs-esslingen.de> (raw)
In-Reply-To: <1382195841-6558-4-git-send-email-fweisbec@gmail.com>
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)
And preferably launch such patch as a preparatory patch for this
subsequent 3/5 patch, within the series?
Unless I missed some other restrictions which cause us to need to cling
to that manual from-us conversion, for now or forever...
Andreas Mohr
next prev parent reply other threads:[~2013-10-20 7:34 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 [this message]
2013-11-04 16:22 ` Frederic Weisbecker
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=20131020073456.GA2729@rhlx01.hs-esslingen.de \
--to=andi@lisas.de \
--cc=fernando_b1@lab.ntt.co.jp \
--cc=fweisbec@gmail.com \
--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
all inboxes | Powered by JetHome®