From: Arjan van de Ven <arjan@infradead.org>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, davej@redhat.com
Subject: [PATCH v2 3/8] sched: Update the idle statistics in get_cpu_idle_time_us()
Date: Sun, 9 May 2010 08:23:23 -0700 [thread overview]
Message-ID: <20100509082323.2d2f1945@infradead.org> (raw)
In-Reply-To: <20100509082126.4a080d46@infradead.org>
From: Arjan van de Ven <arjan@linux.intel.com>
Right now, get_cpu_idle_time_us() only reports the idle statistics
upto the point the CPU entered last idle; not what is valid right now.
This patch adds an update of the idle statistics to get_cpu_idle_time_us(),
so that calling this function always returns statistics that are accurate
at the point of the call.
This includes resetting the start of the idle time for accounting purposes
to avoid double accounting.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Rik van Riel <riel@redhat.com>
---
kernel/time/tick-sched.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff -puN kernel/time/tick-sched.c~sched-update-the-idle-statistics-in-get_cpu_idle_time_us kernel/time/tick-sched.c
--- a/kernel/time/tick-sched.c~sched-update-the-idle-statistics-in-get_cpu_idle_time_us
+++ a/kernel/time/tick-sched.c
@@ -161,6 +161,7 @@ static void update_ts_time_stats(struct
if (ts->idle_active) {
delta = ktime_sub(now, ts->idle_entrytime);
ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
+ ts->idle_entrytime = now;
}
}
@@ -205,14 +206,18 @@ static ktime_t tick_nohz_start_idle(stru
u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time)
{
struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+ ktime_t now;
if (!tick_nohz_enabled)
return -1;
+ now = ktime_get();
+ update_ts_time_stats(ts, now);
+
if (ts->idle_active)
*last_update_time = ktime_to_us(ts->idle_lastupdate);
else
- *last_update_time = ktime_to_us(ktime_get());
+ *last_update_time = ktime_to_us(now);
return ktime_to_us(ts->idle_sleeptime);
}
_
next prev parent reply other threads:[~2010-05-09 15:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 15:21 [PATCH v2 0/8] Fix performance issue with ondemand governor Arjan van de Ven
2010-05-09 15:22 ` [PATCH v2 1/8] sched: Add a comment to get_cpu_idle_time_us() Arjan van de Ven
2010-05-10 5:52 ` [tip:sched/core] " tip-bot for Arjan van de Ven
2010-05-09 15:22 ` [PATCH v2 2/8] sched: Introduce a function to update the idle statistics Arjan van de Ven
2010-05-10 5:52 ` [tip:sched/core] " tip-bot for Arjan van de Ven
2010-05-09 15:23 ` Arjan van de Ven [this message]
2010-05-10 5:53 ` [tip:sched/core] sched: Update the idle statistics in get_cpu_idle_time_us() tip-bot for Arjan van de Ven
2010-05-09 15:24 ` [PATCH v2 4/8] sched: Fold updating of the last_update_time_info into update_ts_time_stats() Arjan van de Ven
2010-05-10 5:53 ` [tip:sched/core] " tip-bot for Arjan van de Ven
2010-05-09 15:24 ` [PATCH v2 5/8] sched: Eliminate the ts->idle_lastupdate field Arjan van de Ven
2010-05-10 5:53 ` [tip:sched/core] " tip-bot for Arjan van de Ven
2010-05-09 15:25 ` [PATCH v2 6/8] sched: Intoduce get_cpu_iowait_time_us() Arjan van de Ven
2010-05-10 5:54 ` [tip:sched/core] " tip-bot for Arjan van de Ven
2010-05-09 15:26 ` [PATCH v2 7/8] ondemand: Solve a big performance issue by counting IOWAIT time as busy Arjan van de Ven
2010-05-10 5:54 ` [tip:sched/core] " tip-bot for Arjan van de Ven
2010-05-09 15:26 ` [PATCH v2 8/8] ondemand: Make the iowait-is-busy time a sysfs tunable Arjan van de Ven
2010-05-10 5:54 ` [tip:sched/core] " tip-bot for Arjan van de Ven
2010-05-09 17:49 ` [PATCH v2 0/8] Fix performance issue with ondemand governor Ingo Molnar
2010-05-24 20:44 ` Rik van Riel
2010-05-28 9:30 ` Ingo Molnar
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=20100509082323.2d2f1945@infradead.org \
--to=arjan@infradead.org \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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