aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorDivyesh Shah <dpshah@google.com>2010-04-01 18:01:24 -0400
committerJens Axboe <jens.axboe@oracle.com>2010-04-02 02:44:36 -0400
commit303a3acb2362f16c7e7f4c53b40c2f4b396dc8d5 (patch)
tree7996f28d5659fef44594f7049e30264b16baa62d /block/blk-cgroup.h
parent9a0785b0da561e1e9c6617df85e93ae107a42f18 (diff)
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;
23#define blkio_subsys_id blkio_subsys.subsys_id 23#define blkio_subsys_id blkio_subsys.subsys_id
24#endif 24#endif
25 25
26enum io_type {
27 IO_READ = 0,
28 IO_WRITE,
29 IO_SYNC,
30 IO_ASYNC,
31 IO_TYPE_MAX
32};
33
26struct blkio_cgroup { 34struct blkio_cgroup {
27 struct cgroup_subsys_state css; 35 struct cgroup_subsys_state css;
28 unsigned int weight; 36 unsigned int weight;
@@ -30,6 +38,23 @@ struct blkio_cgroup {
30 struct hlist_head blkg_list; 38 struct hlist_head blkg_list;
31}; 39};
32 40
41struct blkio_group_stats {
42 /* total disk time and nr sectors dispatched by this group */
43 uint64_t time;
44 uint64_t sectors;
45 /* Total disk time used by IOs in ns */
46 uint64_t io_service_time[IO_TYPE_MAX];
47 uint64_t io_service_bytes[IO_TYPE_MAX]; /* Total bytes transferred */
48 /* Total IOs serviced, post merge */
49 uint64_t io_serviced[IO_TYPE_MAX];
50 /* Total time spent waiting in scheduler queue in ns */
51 uint64_t io_wait_time[IO_TYPE_MAX];
52#ifdef CONFIG_DEBUG_BLK_CGROUP
53 /* How many times this group has been removed from service tree */
54 unsigned long dequeue;
55#endif
56};
57
33struct blkio_group { 58struct blkio_group {
34 /* An rcu protected unique identifier for the group */ 59 /* An rcu protected unique identifier for the group */
35 void *key; 60 void *key;
@@ -38,15 +63,13 @@ struct blkio_group {
38#ifdef CONFIG_DEBUG_BLK_CGROUP 63#ifdef CONFIG_DEBUG_BLK_CGROUP
39 /* Store cgroup path */ 64 /* Store cgroup path */
40 char path[128]; 65 char path[128];
41 /* How many times this group has been removed from service tree */
42 unsigned long dequeue;
43#endif 66#endif
44 /* The device MKDEV(major, minor), this group has been created for */ 67 /* The device MKDEV(major, minor), this group has been created for */
45 dev_t dev; 68 dev_t dev;
46 69
47 /* total disk time and nr sectors dispatched by this group */ 70 /* Need to serialize the stats in the case of reset/update */
48 unsigned long time; 71 spinlock_t stats_lock;
49 unsigned long sectors; 72 struct blkio_group_stats stats;
50}; 73};
51 74
52typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg); 75typedef 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,
105extern int blkiocg_del_blkio_group(struct blkio_group *blkg); 128extern int blkiocg_del_blkio_group(struct blkio_group *blkg);
106extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg, 129extern struct blkio_group *blkiocg_lookup_group(struct blkio_cgroup *blkcg,
107 void *key); 130 void *key);
108void blkiocg_update_blkio_group_stats(struct blkio_group *blkg, 131void blkiocg_update_timeslice_used(struct blkio_group *blkg,
109 unsigned long time); 132 unsigned long time);
110#else 133#else
111struct cgroup; 134struct cgroup;
112static inline struct blkio_cgroup * 135static inline struct blkio_cgroup *
@@ -122,7 +145,7 @@ blkiocg_del_blkio_group(struct blkio_group *blkg) { return 0; }
122 145
123static inline struct blkio_group * 146static inline struct blkio_group *
124blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) { return NULL; } 147blkiocg_lookup_group(struct blkio_cgroup *blkcg, void *key) { return NULL; }
125static inline void blkiocg_update_blkio_group_stats(struct blkio_group *blkg, 148static inline void blkiocg_update_timeslice_used(struct blkio_group *blkg,
126 unsigned long time) {} 149 unsigned long time) {}
127#endif 150#endif
128#endif /* _BLK_CGROUP_H */ 151#endif /* _BLK_CGROUP_H */