From: Arjan van de Ven <arjan@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Arjan van de Ven <arjan@infradead.org>,
akpm@linux-foundation.org, mingo@elte.hu, peterz@infradead.org,
tglx@linutronix.de, davej@redhat.com, cpufreq@vger.kernel.org
Subject: [PATCH 4/7] sched: fold updating of the last update time into update_ts_time_stats()
Date: Sun, 18 Apr 2010 12:02:24 -0700 [thread overview]
Message-ID: <20100418120224.5447dec3@infradead.org> (raw)
In-Reply-To: <20100418115949.7b743898@infradead.org>
>From e75d6cd203e43ea4c5e9919f19e2882c066491b8 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sun, 18 Apr 2010 10:47:02 -0700
Subject: [PATCH 4/7] sched: fold updating of the last update time into update_ts_time_stats()
This patch folds the updating of the last_update_time into the
update_ts_time_stats() function, and updates the callers.
This allows for further cleanups that are done in the next patch.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
kernel/time/tick-sched.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 7dbad2f..ac54543 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -153,7 +153,8 @@ static void tick_nohz_update_jiffies(ktime_t now)
/*
* Updates the per cpu time idle statistics counters
*/
-static void update_ts_time_stats(struct tick_sched *ts, ktime_t now)
+static void
+update_ts_time_stats(struct tick_sched *ts, ktime_t now, u64 *last_update_time)
{
ktime_t delta;
@@ -163,13 +164,19 @@ static void update_ts_time_stats(struct tick_sched *ts, ktime_t now)
ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta);
ts->idle_entrytime = now;
}
+
+ if (ts->idle_active && last_update_time)
+ *last_update_time = ktime_to_us(ts->idle_lastupdate);
+ else
+ *last_update_time = ktime_to_us(now);
+
}
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);
+ update_ts_time_stats(ts, now, NULL);
ts->idle_active = 0;
sched_clock_idle_wakeup_event(0);
@@ -181,7 +188,7 @@ static ktime_t tick_nohz_start_idle(struct tick_sched *ts)
now = ktime_get();
- update_ts_time_stats(ts, now);
+ update_ts_time_stats(ts, now, NULL);
ts->idle_entrytime = now;
ts->idle_active = 1;
@@ -206,18 +213,11 @@ static ktime_t tick_nohz_start_idle(struct tick_sched *ts)
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(now);
+ update_ts_time_stats(ts, ktime_get(), last_update_time);
return ktime_to_us(ts->idle_sleeptime);
}
--
1.6.2.5
next prev parent reply other threads:[~2010-04-18 19:02 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-18 18:59 [PATCH 0/7] Fix performance issue with ondemand governor Arjan van de Ven
2010-04-18 19:00 ` [PATCH 1/7] sched: add a comment to get_cpu_idle_time_us() Arjan van de Ven
2010-04-26 19:25 ` Rik van Riel
2010-04-18 19:01 ` [PATCH 2/7] sched: introduce a function to update the idle statistics Arjan van de Ven
2010-04-26 20:11 ` Rik van Riel
2010-04-18 19:01 ` [PATCH 3/7] sched: update the idle statistics in get_cpu_idle_time_us() Arjan van de Ven
2010-04-26 20:36 ` Rik van Riel
2010-04-18 19:02 ` Arjan van de Ven [this message]
2010-04-26 20:58 ` [PATCH 4/7] sched: fold updating of the last update time into update_ts_time_stats() Rik van Riel
2010-04-18 19:02 ` [PATCH 5/7] sched: eliminate the ts->idle_lastupdate field Arjan van de Ven
2010-04-26 21:00 ` Rik van Riel
2010-04-18 19:03 ` [PATCH 6/7] sched: introduce get_cpu_iowait_time_us() Arjan van de Ven
2010-04-26 21:05 ` Rik van Riel
2010-04-18 19:03 ` [PATCH 7/7] ondemand: Solve the big performance issue with ondemand during disk IO Arjan van de Ven
2010-04-19 8:29 ` Éric Piel
2010-04-19 13:43 ` Arjan van de Ven
2010-04-19 14:30 ` Éric Piel
2010-04-19 14:47 ` Arjan van de Ven
2010-04-20 9:24 ` Thomas Renninger
2010-04-27 0:29 ` Mike Chan
2010-04-27 13:01 ` Pavel Machek
2010-04-27 18:10 ` Mike Chan
2010-04-19 9:09 ` Tvrtko Ursulin
2010-04-19 13:46 ` Arjan van de Ven
2010-04-19 15:29 ` Tvrtko Ursulin
2010-04-20 0:47 ` Arjan van de Ven
2010-04-20 9:10 ` Tvrtko Ursulin
2010-04-20 11:02 ` Arjan van de Ven
2010-04-28 8:57 ` Tvrtko Ursulin
2010-04-23 5:26 ` Pavel Machek
2010-04-20 9:29 ` Thomas Renninger
2010-04-20 11:07 ` Arjan van de Ven
2010-04-23 5:24 ` Pavel Machek
2010-04-23 5:38 ` Willy Tarreau
2010-04-23 8:50 ` Thomas Renninger
2010-04-23 16:08 ` Arjan van de Ven
2010-04-27 11:39 ` Thomas Renninger
2010-05-04 3:48 ` [PATCH 8/7] cpufreq: make the iowait-is-busy-time a sysfs tunable Arjan van de Ven
2010-05-04 4:16 ` Willy Tarreau
2010-05-04 5:43 ` Pavel Machek
2010-05-04 13:51 ` Rik van Riel
2010-04-23 14:10 ` [PATCH 7/7] ondemand: Solve the big performance issue with ondemand during disk IO Arjan van de Ven
2010-04-23 15:35 ` Willy Tarreau
2010-04-23 13:52 ` Arjan van de Ven
2010-04-23 8:38 ` Pavel Machek
2010-04-23 16:06 ` Arjan van de Ven
2010-04-24 4:56 ` Pavel Machek
2010-05-01 23:29 ` Arjan van de Ven
2010-04-26 21:30 ` Rik van Riel
2010-04-26 21:41 ` [PATCH 0/7] Fix performance issue with ondemand governor Dave Jones
2010-04-26 21:45 ` Dominik Brodowski
2010-04-26 21:59 ` Rik van Riel
2010-04-26 22:05 ` Dominik Brodowski
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=20100418120224.5447dec3@infradead.org \
--to=arjan@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=cpufreq@vger.kernel.org \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.