aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-03-05 16:15:00 -0500
committerJens Axboe <axboe@kernel.dk>2012-03-06 15:27:22 -0500
commit72e06c255181537d0b3e1f657a9ed81655d745b1 (patch)
treeeb656df2ad23a7709b4e9fe58f1dabdc32be9ae9 /block/blk-cgroup.h
parent6ecf23afab13c39d3bb0e2d826d0984b0dd53733 (diff)
blkcg: shoot down blkio_groups on elevator switch
Elevator switch may involve changes to blkcg policies. Implement shoot down of blkio_groups. Combined with the previous bypass updates, the end goal is updating blkcg core such that it can ensure that blkcg's being affected become quiescent and don't have any per-blkg data hanging around before commencing any policy updates. Until queues are made aware of the policies that applies to them, as an interim step, all per-policy blkg data will be shot down. * blk-throtl doesn't need this change as it can't be disabled for a live queue; however, update it anyway as the scheduled blkg unification requires this behavior change. This means that blk-throtl configuration will be unnecessarily lost over elevator switch. This oddity will be removed after blkcg learns to associate individual policies with request_queues. * blk-throtl dosen't shoot down root_tg. This is to ease transition. Unified blkg will always have persistent root group and not shooting down root_tg for now eases transition to that point by avoiding having to update td->root_tg and is safe as blk-throtl can never be disabled -v2: Vivek pointed out that group list is not guaranteed to be empty on return from clear function if it raced cgroup removal and lost. Fix it by waiting a bit and retrying. This kludge will soon be removed once locking is updated such that blkg is never in limbo state between blkcg and request_queue locks. blk-throtl no longer shoots down root_tg to avoid breaking td->root_tg. Also, Nest queue_lock inside blkio_list_lock not the other way around to avoid introduce possible deadlock via blkcg lock. -v3: blkcg_clear_queue() repositioned and renamed to blkg_destroy_all() to increase consistency with later changes. cfq_clear_queue() updated to check q->elevator before dereferencing it to avoid NULL dereference on not fully initialized queues (used by later change). Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 355168772f51..e5cfcbd4d2f4 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -203,7 +203,7 @@ extern unsigned int blkcg_get_write_iops(struct blkio_cgroup *blkcg,
203 dev_t dev); 203 dev_t dev);
204 204
205typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg); 205typedef void (blkio_unlink_group_fn) (void *key, struct blkio_group *blkg);
206 206typedef bool (blkio_clear_queue_fn)(struct request_queue *q);
207typedef void (blkio_update_group_weight_fn) (void *key, 207typedef void (blkio_update_group_weight_fn) (void *key,
208 struct blkio_group *blkg, unsigned int weight); 208 struct blkio_group *blkg, unsigned int weight);
209typedef void (blkio_update_group_read_bps_fn) (void * key, 209typedef void (blkio_update_group_read_bps_fn) (void * key,
@@ -217,6 +217,7 @@ typedef void (blkio_update_group_write_iops_fn) (void *key,
217 217
218struct blkio_policy_ops { 218struct blkio_policy_ops {
219 blkio_unlink_group_fn *blkio_unlink_group_fn; 219 blkio_unlink_group_fn *blkio_unlink_group_fn;
220 blkio_clear_queue_fn *blkio_clear_queue_fn;
220 blkio_update_group_weight_fn *blkio_update_group_weight_fn; 221 blkio_update_group_weight_fn *blkio_update_group_weight_fn;
221 blkio_update_group_read_bps_fn *blkio_update_group_read_bps_fn; 222 blkio_update_group_read_bps_fn *blkio_update_group_read_bps_fn;
222 blkio_update_group_write_bps_fn *blkio_update_group_write_bps_fn; 223 blkio_update_group_write_bps_fn *blkio_update_group_write_bps_fn;
@@ -233,6 +234,7 @@ struct blkio_policy_type {
233/* Blkio controller policy registration */ 234/* Blkio controller policy registration */
234extern void blkio_policy_register(struct blkio_policy_type *); 235extern void blkio_policy_register(struct blkio_policy_type *);
235extern void blkio_policy_unregister(struct blkio_policy_type *); 236extern void blkio_policy_unregister(struct blkio_policy_type *);
237extern void blkg_destroy_all(struct request_queue *q);
236 238
237static inline char *blkg_path(struct blkio_group *blkg) 239static inline char *blkg_path(struct blkio_group *blkg)
238{ 240{
@@ -249,6 +251,7 @@ struct blkio_policy_type {
249 251
250static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { } 252static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { }
251static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } 253static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { }
254static inline void blkg_destroy_all(struct request_queue *q) { }
252 255
253static inline char *blkg_path(struct blkio_group *blkg) { return NULL; } 256static inline char *blkg_path(struct blkio_group *blkg) { return NULL; }
254 257