diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-13 16:11:33 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-04-20 04:06:06 -0400 |
commit | a2b1693bac45ea3fe3ba612fd22c45f17449f610 (patch) | |
tree | 2e05859caab6453efbc85d584dd72dca7ef03cd0 /block/blk-cgroup.h | |
parent | 03d8e11142a893ad322285d3c8a08e88b570cda1 (diff) |
blkcg: implement per-queue policy activation
All blkcg policies were assumed to be enabled on all request_queues.
Due to various implementation obstacles, during the recent blkcg core
updates, this was temporarily implemented as shooting down all !root
blkgs on elevator switch and policy [de]registration combined with
half-broken in-place root blkg updates. In addition to being buggy
and racy, this meant losing all blkcg configurations across those
events.
Now that blkcg is cleaned up enough, this patch replaces the temporary
implementation with proper per-queue policy activation. Each blkcg
policy should call the new blkcg_[de]activate_policy() to enable and
disable the policy on a specific queue. blkcg_activate_policy()
allocates and installs policy data for the policy for all existing
blkgs. blkcg_deactivate_policy() does the reverse. If a policy is
not enabled for a given queue, blkg printing / config functions skip
the respective blkg for the queue.
blkcg_activate_policy() also takes care of root blkg creation, and
cfq_init_queue() and blk_throtl_init() are updated accordingly.
This replaces blkcg_bypass_{start|end}() and update_root_blkg_pd()
unnecessary. Dropped.
v2: cfq_init_queue() was returning uninitialized @ret on root_group
alloc failure if !CONFIG_CFQ_GROUP_IOSCHED. Fixed.
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.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index df1c7b290c22..66253a7c8ff4 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -64,6 +64,9 @@ struct blkg_policy_data { | |||
64 | /* the blkg this per-policy data belongs to */ | 64 | /* the blkg this per-policy data belongs to */ |
65 | struct blkio_group *blkg; | 65 | struct blkio_group *blkg; |
66 | 66 | ||
67 | /* used during policy activation */ | ||
68 | struct list_head alloc_node; | ||
69 | |||
67 | /* pol->pdata_size bytes of private data used by policy impl */ | 70 | /* pol->pdata_size bytes of private data used by policy impl */ |
68 | char pdata[] __aligned(__alignof__(unsigned long long)); | 71 | char pdata[] __aligned(__alignof__(unsigned long long)); |
69 | }; | 72 | }; |
@@ -108,9 +111,11 @@ extern void blkcg_exit_queue(struct request_queue *q); | |||
108 | /* Blkio controller policy registration */ | 111 | /* Blkio controller policy registration */ |
109 | extern int blkio_policy_register(struct blkio_policy_type *); | 112 | extern int blkio_policy_register(struct blkio_policy_type *); |
110 | extern void blkio_policy_unregister(struct blkio_policy_type *); | 113 | extern void blkio_policy_unregister(struct blkio_policy_type *); |
114 | extern int blkcg_activate_policy(struct request_queue *q, | ||
115 | const struct blkio_policy_type *pol); | ||
116 | extern void blkcg_deactivate_policy(struct request_queue *q, | ||
117 | const struct blkio_policy_type *pol); | ||
111 | extern void blkg_destroy_all(struct request_queue *q, bool destroy_root); | 118 | extern void blkg_destroy_all(struct request_queue *q, bool destroy_root); |
112 | extern void update_root_blkg_pd(struct request_queue *q, | ||
113 | const struct blkio_policy_type *pol); | ||
114 | 119 | ||
115 | void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, | 120 | void blkcg_print_blkgs(struct seq_file *sf, struct blkio_cgroup *blkcg, |
116 | u64 (*prfill)(struct seq_file *, void *, int), | 121 | u64 (*prfill)(struct seq_file *, void *, int), |
@@ -325,10 +330,12 @@ static inline void blkcg_drain_queue(struct request_queue *q) { } | |||
325 | static inline void blkcg_exit_queue(struct request_queue *q) { } | 330 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
326 | static inline int blkio_policy_register(struct blkio_policy_type *blkiop) { return 0; } | 331 | static inline int blkio_policy_register(struct blkio_policy_type *blkiop) { return 0; } |
327 | static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } | 332 | static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } |
333 | static inline int blkcg_activate_policy(struct request_queue *q, | ||
334 | const struct blkio_policy_type *pol) { return 0; } | ||
335 | static inline void blkcg_deactivate_policy(struct request_queue *q, | ||
336 | const struct blkio_policy_type *pol) { } | ||
328 | static inline void blkg_destroy_all(struct request_queue *q, | 337 | static inline void blkg_destroy_all(struct request_queue *q, |
329 | bool destory_root) { } | 338 | bool destory_root) { } |
330 | static inline void update_root_blkg_pd(struct request_queue *q, | ||
331 | const struct blkio_policy_type *pol) { } | ||
332 | 339 | ||
333 | static inline void *blkg_to_pdata(struct blkio_group *blkg, | 340 | static inline void *blkg_to_pdata(struct blkio_group *blkg, |
334 | struct blkio_policy_type *pol) { return NULL; } | 341 | struct blkio_policy_type *pol) { return NULL; } |