[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c4bdb9728146c75ac78a4a98892cd216a00aef8f@git.kernel.org>
Date: Mon, 3 Aug 2009 13:21:50 GMT
From: tip-bot for Arjan van de Ven <arjan@...ux.intel.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
a.p.zijlstra@...llo.nl, arjan@...ux.intel.com, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:sched/core] sched: Provide iowait counters
Commit-ID: c4bdb9728146c75ac78a4a98892cd216a00aef8f
Gitweb: http://git.kernel.org/tip/c4bdb9728146c75ac78a4a98892cd216a00aef8f
Author: Arjan van de Ven <arjan@...ux.intel.com>
AuthorDate: Mon, 20 Jul 2009 11:26:58 -0700
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Mon, 3 Aug 2009 14:35:36 +0200
sched: Provide iowait counters
For counting how long an application has been waiting for
(disk) IO, there currently is only the HZ sample driven
information available, while for all other counters in this
class, a high resolution version is available via
CONFIG_SCHEDSTATS.
In order to make an improved bootchart tool possible, we also
need a higher resolution version of the iowait time.
This patch below adds this scheduler statistic to the
kernel - the next patch will extend perfcounters to
make use of it.
Signed-off-by: Arjan van de Ven <arjan@...ux.intel.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
LKML-Reference: <4A64B813.1080506@...ux.intel.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
include/linux/sched.h | 4 ++++
kernel/sched.c | 4 ++++
kernel/sched_debug.c | 2 ++
kernel/sched_fair.c | 5 +++++
4 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 195d72d..9da9506 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1111,6 +1111,8 @@ struct sched_entity {
u64 wait_max;
u64 wait_count;
u64 wait_sum;
+ u64 iowait_count;
+ u64 iowait_sum;
u64 sleep_start;
u64 sleep_max;
@@ -1230,6 +1232,8 @@ struct task_struct {
unsigned did_exec:1;
unsigned in_execve:1; /* Tell the LSMs that the process is doing an
* execve */
+ unsigned in_iowait:1;
+
/* Revert to default priority/policy when forking */
unsigned sched_reset_on_fork:1;
diff --git a/kernel/sched.c b/kernel/sched.c
index 7f83be3..668bfbe 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6748,7 +6748,9 @@ void __sched io_schedule(void)
delayacct_blkio_start();
atomic_inc(&rq->nr_iowait);
+ current->in_iowait = 1;
schedule();
+ current->in_iowait = 0;
atomic_dec(&rq->nr_iowait);
delayacct_blkio_end();
}
@@ -6761,7 +6763,9 @@ long __sched io_schedule_timeout(long timeout)
delayacct_blkio_start();
atomic_inc(&rq->nr_iowait);
+ current->in_iowait = 1;
ret = schedule_timeout(timeout);
+ current->in_iowait = 0;
atomic_dec(&rq->nr_iowait);
delayacct_blkio_end();
return ret;
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 70c7e0b..7d3f0a4 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -479,6 +479,8 @@ void proc_sched_set_task(struct task_struct *p)
p->se.wait_max = 0;
p->se.wait_sum = 0;
p->se.wait_count = 0;
+ p->se.iowait_sum = 0;
+ p->se.iowait_count = 0;
p->se.sleep_max = 0;
p->se.sum_sleep_runtime = 0;
p->se.block_max = 0;
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 342000b..471fa28 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -652,6 +652,11 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
se->sum_sleep_runtime += delta;
if (tsk) {
+ if (tsk->in_iowait) {
+ se->iowait_sum += delta;
+ se->iowait_count++;
+ }
+
/*
* Blocking time is in units of nanosecs, so shift by
* 20 to get a milliseconds-range estimation of the
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists