summaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorDivyesh Shah <dpshah@google.com>2010-04-01 15:01:24 -0700
committerJens Axboe <jens.axboe@oracle.com>2010-04-02 08:44:36 +0200
commit303a3acb2362f16c7e7f4c53b40c2f4b396dc8d5 (patch)
tree7996f28d5659fef44594f7049e30264b16baa62d /block/blk-cgroup.h
parent9a0785b0da561e1e9c6617df85e93ae107a42f18 (diff)
downloadlinux-303a3acb2362f16c7e7f4c53b40c2f4b396dc8d5.tar.bz2
blkio: Add io controller stats like
- io_service_time - io_wait_time - io_serviced - io_service_bytes These stats are accumulated per operation type helping us to distinguish between read and write, and sync and async IO. This patch does not increment any of these stats. Signed-off-by: Divyesh Shah<dpshah@google.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h39
1 files changed, 31 insertions, 8 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index fe445178f586..5c5e5294b506 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -23,6 +23,14 @@ extern struct cgroup_subsys blkio_subsys;
#define blkio_subsys_id blkio_subsys.subsys_id
#endif
+enum io_type {
+ IO_READ = 0,
+ IO_WRITE,
+ IO_SYNC,
+ IO_ASYNC,
+ IO_TYPE_MAX
+};
+
struct blkio_cgroup {
struct cgroup_subsys_state css;
unsigned int weight;
@@ -30,6 +38,23 @@ struct blkio_cgroup {
struct hlist_head blkg_list;
};
+struct blkio_group_stats {
+ /* total disk time and nr sectors dispatched by this group */
+ uint64_t time;
+ uint64_t sectors;
+ /* Total disk time used by IOs in ns */
+ uint64_t io_service_time[IO_TYPE_MAX];
+ uint64_t io_service_bytes[IO_TYPE_MAX]; /* Total bytes transferred */
+ /* Total IOs serviced, post merge */
+ uint64_t io_serviced[IO_TYPE_MAX];
+ /* Total time spent waiting in scheduler queue in ns */
+ uint64_t io_wait_time[IO_TYPE_MAX];
+#ifdef CONFIG_DEBUG_BLK_CGROUP
+ /* How many times this group has been removed from service tree */
+ unsigned long dequeue;
+#endif
+};
+
struct blkio_group {
/* An rcu protected unique identifier for the group */
void *key;
@@ -38,15 +63,13 @@ struct blkio_group {
#ifdef CONFIG_DEBUG_BLK_CGROUP
/* Store cgroup path */
char path[128];
- /* How many times this group has been removed from service tree */
- unsigned long dequeue;
#endif
/* The device MKDEV(major, minor), this group has been created for */
dev_t dev;
- /* total disk time and nr sectors dispatched by this group */
- unsigned long time;
- unsigned long sectors;
+ /* Need to serialize the stats in the case of reset/update */
+ spinlock_t stats_lock;
+ struct blkio_group_stats stats;
};
typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg);
@@ -105,8 +128,8 @@ extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
void *key);
-void blkiocg_update_blkio_group_stats(struct blkio_group *blkg,
- unsigned long time);
+void blkiocg_update_timeslice_used(struct blkio_group *blkg,
+ unsigned long time);
#else
struct cgroup;
static inline struct blkio_cgroup *
@@ -122,7 +145,7 @@ blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; }
static inline struct blkio_group *
blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) { return NULL; }
-static inline void blkiocg_update_blkio_group_stats(struct blkio_group *blkg,
+static inline void blkiocg_update_timeslice_used(struct blkio_group *blkg,
unsigned long time) {}
#endif
#endif /* _BLK_CGROUP_H */