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 2/8] sched: Introduce a function to update the idle statistics
Date: Sun, 9 May 2010 08:22:45 -0700 [thread overview]
Message-ID: <20100509082245.163e67ed@infradead.org> (raw)
In-Reply-To: <20100509082126.4a080d46@infradead.org>
From: Arjan van de Ven <arjan@linux.intel.com>
Currently, two places update the idle statistics (and more to
come later in this series).
This patch creates a helper function for updating these statistics.
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 | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff -puN kernel/time/tick-sched.c~sched-introduce-a-function-to-update-the-idle-statistics kernel/time/tick-sched.c
--- a/kernel/time/tick-sched.c~sched-introduce-a-function-to-update-the-idle-statistics
+++ a/kernel/time/tick-sched.c
@@ -150,14 +150,25 @@ static void tick_nohz_update_jiffies(kti
touch_softlockup_watchdog();
}
-static void tick_nohz_stop_idle(int cpu, ktime_t now)
+/*
+ * Updates the per cpu time idle statistics counters
+ */
+static void update_ts_time_stats(struct tick_sched *ts, ktime_t now)
{
- struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
ktime_t delta;
- delta = ktime_sub(now, ts->idle_entrytime);
ts->idle_lastupdate = now;
- ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
+ if (ts->idle_active) {
+ delta = ktime_sub(now, ts->idle_entrytime);
+ ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
+ }
+}
+
+static void tick_nohz_stop_idle(int cpu, ktime_t now)
+{
+ struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
+
+ update_ts_time_stats(ts, now);
ts->idle_active = 0;
sched_clock_idle_wakeup_event(0);
@@ -165,14 +176,12 @@ static void tick_nohz_stop_idle(int cpu,
static ktime_t tick_nohz_start_idle(struct tick_sched *ts)
{
- ktime_t now, delta;
+ ktime_t now;
now = ktime_get();
- if (ts->idle_active) {
- delta = ktime_sub(now, ts->idle_entrytime);
- ts->idle_lastupdate = now;
- ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
- }
+
+ update_ts_time_stats(ts, now);
+
ts->idle_entrytime = now;
ts->idle_active = 1;
sched_clock_idle_sleep_event();
_
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 ` Arjan van de Ven [this message]
2010-05-10 5:52 ` [tip:sched/core] sched: Introduce a function to update the idle statistics tip-bot for Arjan van de Ven
2010-05-09 15:23 ` [PATCH v2 3/8] sched: Update the idle statistics in get_cpu_idle_time_us() 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 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=20100509082245.163e67ed@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