diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2010-09-15 17:06:34 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-09-16 02:42:12 -0400 |
commit | 4c9eefa16c6f124ffcc736cb719b24ea27f85017 (patch) | |
tree | 0fc333553f66b72c3eb1bd532e45040d90e68f1f /block/blk-cgroup.h | |
parent | 062a644d6121d5e2f51c0b2ca0cbc5155ebf845b (diff) |
blk-cgroup: Introduce cgroup changes for throttling policy
o cgroup chagnes for throttle policy.
o Introduces READ and WRITE bytes per second throttling rules.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r-- | block/blk-cgroup.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index c8de2598429d..1b738827b2f6 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | enum blkio_policy_id { | 18 | enum blkio_policy_id { |
19 | BLKIO_POLICY_PROP = 0, /* Proportional Bandwidth division */ | 19 | BLKIO_POLICY_PROP = 0, /* Proportional Bandwidth division */ |
20 | BLKIO_POLICY_THROTL, /* Throttling */ | ||
20 | }; | 21 | }; |
21 | 22 | ||
22 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) | 23 | #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) |
@@ -88,6 +89,14 @@ enum blkcg_file_name_prop { | |||
88 | BLKIO_PROP_dequeue, | 89 | BLKIO_PROP_dequeue, |
89 | }; | 90 | }; |
90 | 91 | ||
92 | /* cgroup files owned by throttle policy */ | ||
93 | enum blkcg_file_name_throtl { | ||
94 | BLKIO_THROTL_read_bps_device, | ||
95 | BLKIO_THROTL_write_bps_device, | ||
96 | BLKIO_THROTL_io_service_bytes, | ||
97 | BLKIO_THROTL_io_serviced, | ||
98 | }; | ||
99 | |||
91 | struct blkio_cgroup { | 100 | struct blkio_cgroup { |
92 | struct cgroup_subsys_state css; | 101 | struct cgroup_subsys_state css; |
93 | unsigned int weight; | 102 | unsigned int weight; |
@@ -146,23 +155,42 @@ struct blkio_group { | |||
146 | struct blkio_policy_node { | 155 | struct blkio_policy_node { |
147 | struct list_head node; | 156 | struct list_head node; |
148 | dev_t dev; | 157 | dev_t dev; |
149 | unsigned int weight; | ||
150 | /* This node belongs to max bw policy or porportional weight policy */ | 158 | /* This node belongs to max bw policy or porportional weight policy */ |
151 | enum blkio_policy_id plid; | 159 | enum blkio_policy_id plid; |
152 | /* cgroup file to which this rule belongs to */ | 160 | /* cgroup file to which this rule belongs to */ |
153 | int fileid; | 161 | int fileid; |
162 | |||
163 | union { | ||
164 | unsigned int weight; | ||
165 | /* | ||
166 | * Rate read/write in terms of byptes per second | ||
167 | * Whether this rate represents read or write is determined | ||
168 | * by file type "fileid". | ||
169 | */ | ||
170 | u64 bps; | ||
171 | } val; | ||
154 | }; | 172 | }; |
155 | 173 | ||
156 | extern unsigned int blkcg_get_weight(struct blkio_cgroup *blkcg, | 174 | extern unsigned int blkcg_get_weight(struct blkio_cgroup *blkcg, |
157 | dev_t dev); | 175 | dev_t dev); |
176 | extern uint64_t blkcg_get_read_bps(struct blkio_cgroup *blkcg, | ||
177 | dev_t dev); | ||
178 | extern uint64_t blkcg_get_write_bps(struct blkio_cgroup *blkcg, | ||
179 | dev_t dev); | ||
158 | 180 | ||
159 | typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg); | 181 | typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg); |
160 | typedef void (blkio_update_group_weight_fn) (struct blkio_group *blkg, | 182 | typedef void (blkio_update_group_weight_fn) (struct blkio_group *blkg, |
161 | unsigned int weight); | 183 | unsigned int weight); |
184 | typedef void (blkio_update_group_read_bps_fn) (struct blkio_group *blkg, | ||
185 | u64 read_bps); | ||
186 | typedef void (blkio_update_group_write_bps_fn) (struct blkio_group *blkg, | ||
187 | u64 write_bps); | ||
162 | 188 | ||
163 | struct blkio_policy_ops { | 189 | struct blkio_policy_ops { |
164 | blkio_unlink_group_fn *blkio_unlink_group_fn; | 190 | blkio_unlink_group_fn *blkio_unlink_group_fn; |
165 | blkio_update_group_weight_fn *blkio_update_group_weight_fn; | 191 | blkio_update_group_weight_fn *blkio_update_group_weight_fn; |
192 | blkio_update_group_read_bps_fn *blkio_update_group_read_bps_fn; | ||
193 | blkio_update_group_write_bps_fn *blkio_update_group_write_bps_fn; | ||
166 | }; | 194 | }; |
167 | 195 | ||
168 | struct blkio_policy_type { | 196 | struct blkio_policy_type { |