From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: Vivek Goyal <vgoyal@redhat.com>, Jens Axboe <jens.axboe@oracle.com>
Cc: linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/4] io-controller: a new interface to keep track of bytes during group is backlogged
Date: Fri, 21 May 2010 16:43:01 +0800 [thread overview]
Message-ID: <4BF64795.4040000@cn.fujitsu.com> (raw)
In-Reply-To: <4BF64712.1070500@cn.fujitsu.com>
Add a new interface to keep track of how many bytes tranferred since this
group become backlogged. It'll be reset when this group dequeued.
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
---
block/blk-cgroup.c | 24 ++++++++++++++++++++++++
block/blk-cgroup.h | 6 ++++++
block/cfq-iosched.c | 1 +
3 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 60bb049..749fc6b 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -292,6 +292,22 @@ void blkiocg_update_timeslice_used(struct blkio_group *blkg, unsigned long time)
}
EXPORT_SYMBOL_GPL(blkiocg_update_timeslice_used);
+void blkiocg_reset_active_bytes(struct blkio_group *blkg)
+{
+ int i;
+ struct blkio_group_stats *stats;
+ unsigned long flags;
+
+ spin_lock_irqsave(&blkg->stats_lock, flags);
+
+ stats = &blkg->stats;
+ for (i = 0; i < BLKIO_STAT_TOTAL; i++)
+ stats->stat_arr[BLKIO_STAT_ACTIVE_BYTES][i] = 0;
+
+ spin_unlock_irqrestore(&blkg->stats_lock, flags);
+}
+EXPORT_SYMBOL_GPL(blkiocg_reset_active_bytes);
+
void blkiocg_update_dispatch_stats(struct blkio_group *blkg,
uint64_t bytes, bool direction, bool sync)
{
@@ -305,6 +321,8 @@ void blkiocg_update_dispatch_stats(struct blkio_group *blkg,
sync);
blkio_add_stat(stats->stat_arr[BLKIO_STAT_SERVICE_BYTES], bytes,
direction, sync);
+ blkio_add_stat(stats->stat_arr[BLKIO_STAT_ACTIVE_BYTES], bytes,
+ direction, sync);
spin_unlock_irqrestore(&blkg->stats_lock, flags);
}
EXPORT_SYMBOL_GPL(blkiocg_update_dispatch_stats);
@@ -625,6 +643,7 @@ static int blkiocg_##__VAR##_read(struct cgroup *cgroup, \
SHOW_FUNCTION_PER_GROUP(time, BLKIO_STAT_TIME, 0);
SHOW_FUNCTION_PER_GROUP(sectors, BLKIO_STAT_SECTORS, 0);
SHOW_FUNCTION_PER_GROUP(io_service_bytes, BLKIO_STAT_SERVICE_BYTES, 1);
+SHOW_FUNCTION_PER_GROUP(io_active_bytes, BLKIO_STAT_ACTIVE_BYTES, 1);
SHOW_FUNCTION_PER_GROUP(io_serviced, BLKIO_STAT_SERVICED, 1);
SHOW_FUNCTION_PER_GROUP(io_service_time, BLKIO_STAT_SERVICE_TIME, 1);
SHOW_FUNCTION_PER_GROUP(io_wait_time, BLKIO_STAT_WAIT_TIME, 1);
@@ -851,6 +870,11 @@ struct cftype blkio_files[] = {
.read_map = blkiocg_io_service_bytes_read,
},
{
+ .name = "io_active_bytes",
+ .read_map = blkiocg_io_active_bytes_read,
+ },
+
+ {
.name = "io_serviced",
.read_map = blkiocg_io_serviced_read,
},
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 2b866ec..67d4284 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -30,6 +30,11 @@ enum stat_type {
BLKIO_STAT_SERVICE_TIME = 0,
/* Total bytes transferred */
BLKIO_STAT_SERVICE_BYTES,
+ /*
+ * Total bytes transferred since group became backlogged, will reset
+ * when group dequeued.
+ */
+ BLKIO_STAT_ACTIVE_BYTES,
/* Total IOs serviced, post merge */
BLKIO_STAT_SERVICED,
/* Total time spent waiting in scheduler queue in ns */
@@ -144,6 +149,7 @@ struct blkio_policy_type {
/* Blkio controller policy registration */
extern void blkio_policy_register(struct blkio_policy_type *);
extern void blkio_policy_unregister(struct blkio_policy_type *);
+extern void blkiocg_reset_active_bytes(struct blkio_group *);
static inline char *blkg_path(struct blkio_group *blkg)
{
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0f3eb70..d4a3525 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -858,6 +858,7 @@ cfq_group_service_tree_del(struct cfq_data *cfqd, struct cfq_group *cfqg)
cfq_rb_erase(&cfqg->rb_node, st);
cfqg->saved_workload_slice = 0;
blkiocg_update_dequeue_stats(&cfqg->blkg, 1);
+ blkiocg_reset_active_bytes(&cfqg->blkg);
}
static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq)
-- 1.5.4.rc3
next prev parent reply other threads:[~2010-05-21 8:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 8:40 [PATCH 0/4] io-controller: Add new interfaces to trace backlogged group status Gui Jianfeng
2010-05-21 8:43 ` Gui Jianfeng [this message]
2010-05-21 8:44 ` [PATCH 2/4] io-controller: a new interface to keep track of the time since group bacame backlogged Gui Jianfeng
2010-05-21 8:45 ` [PATCH 3/4] io-controller: a new interface to keep track of io rate when group is backlogged Gui Jianfeng
2010-05-21 8:46 ` [PATCH 4/4] io-controller: Document for active bytes, time and rate Gui Jianfeng
2010-05-26 18:57 ` Randy Dunlap
2010-05-21 13:17 ` [PATCH 0/4] io-controller: Add new interfaces to trace backlogged group status Vivek Goyal
2010-05-24 1:12 ` Gui Jianfeng
2010-05-24 21:22 ` Vivek Goyal
2010-05-25 1:37 ` Gui Jianfeng
2010-05-25 2:03 ` Vivek Goyal
2010-05-25 3:00 ` Gui Jianfeng
2010-05-25 13:25 ` Vivek Goyal
2010-06-11 5:10 ` Divyesh Shah
2010-06-11 6:31 ` Gui Jianfeng
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=4BF64795.4040000@cn.fujitsu.com \
--to=guijianfeng@cn.fujitsu.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vgoyal@redhat.com \
/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