diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-05 16:15:20 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-06 15:27:23 -0500 |
commit | e8989fae38d9831c72b20375a206a919ca468c52 (patch) | |
tree | 2eeb1320e526cd0ba187465c0e6e19799dc1b956 /block/blk-cgroup.h | |
parent | 03aa264ac15637b6f98374270bcdf31400965505 (diff) |
blkcg: unify blkg's for blkcg policies
Currently, blkg is per cgroup-queue-policy combination. This is
unnatural and leads to various convolutions in partially used
duplicate fields in blkg, config / stat access, and general management
of blkgs.
This patch make blkg's per cgroup-queue and let them serve all
policies. blkgs are now created and destroyed by blkcg core proper.
This will allow further consolidation of common management logic into
blkcg core and API with better defined semantics and layering.
As a transitional step to untangle blkg management, elvswitch and
policy [de]registration, all blkgs except the root blkg are being shot
down during elvswitch and bypass. This patch adds blkg_root_update()
to update root blkg in place on policy change. This is hacky and racy
but should be good enough as interim step until we get locking
simplified and switch over to proper in-place update for all blkgs.
-v2: Root blkgs need to be updated on elvswitch too and blkg_alloc()
comment wasn't updated according to the function change. Fixed.
Both pointed out by Vivek.
-v3: v2 updated blkg_destroy_all() to invoke update_root_blkg_pd() for
all policies. This freed root pd during elvswitch before the
last queue finished exiting and led to oops. Directly invoke
update_root_blkg_pd() only on BLKIO_POLICY_PROP from
cfq_exit_queue(). This also is closer to what will be done with
proper in-place blkg update. Reported by Vivek.
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, 7 insertions, 8 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 83ce5fa0a604..6e8ee86a2870 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -178,13 +178,11 @@ struct blkg_policy_data { | |||
178 | struct blkio_group { | 178 | struct blkio_group { |
179 | /* Pointer to the associated request_queue, RCU protected */ | 179 | /* Pointer to the associated request_queue, RCU protected */ |
180 | struct request_queue __rcu *q; | 180 | struct request_queue __rcu *q; |
181 | struct list_head q_node[BLKIO_NR_POLICIES]; | 181 | struct list_head q_node; |
182 | struct hlist_node blkcg_node; | 182 | struct hlist_node blkcg_node; |
183 | struct blkio_cgroup *blkcg; | 183 | struct blkio_cgroup *blkcg; |
184 | /* Store cgroup path */ | 184 | /* Store cgroup path */ |
185 | char path[128]; | 185 | char path[128]; |
186 | /* policy which owns this blk group */ | ||
187 | enum blkio_policy_id plid; | ||
188 | /* reference count */ | 186 | /* reference count */ |
189 | int refcnt; | 187 | int refcnt; |
190 | 188 | ||
@@ -230,8 +228,9 @@ extern void blkcg_exit_queue(struct request_queue *q); | |||
230 | /* Blkio controller policy registration */ | 228 | /* Blkio controller policy registration */ |
231 | extern void blkio_policy_register(struct blkio_policy_type *); | 229 | extern void blkio_policy_register(struct blkio_policy_type *); |
232 | extern void blkio_policy_unregister(struct blkio_policy_type *); | 230 | extern void blkio_policy_unregister(struct blkio_policy_type *); |
233 | extern void blkg_destroy_all(struct request_queue *q, | 231 | extern void blkg_destroy_all(struct request_queue *q, bool destroy_root); |
234 | enum blkio_policy_id plid, bool destroy_root); | 232 | extern void update_root_blkg_pd(struct request_queue *q, |
233 | enum blkio_policy_id plid); | ||
235 | 234 | ||
236 | /** | 235 | /** |
237 | * blkg_to_pdata - get policy private data | 236 | * blkg_to_pdata - get policy private data |
@@ -313,8 +312,9 @@ static inline void blkcg_exit_queue(struct request_queue *q) { } | |||
313 | static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { } | 312 | static inline void blkio_policy_register(struct blkio_policy_type *blkiop) { } |
314 | static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } | 313 | static inline void blkio_policy_unregister(struct blkio_policy_type *blkiop) { } |
315 | static inline void blkg_destroy_all(struct request_queue *q, | 314 | static inline void blkg_destroy_all(struct request_queue *q, |
316 | enum blkio_policy_id plid, | ||
317 | bool destory_root) { } | 315 | bool destory_root) { } |
316 | static inline void update_root_blkg_pd(struct request_queue *q, | ||
317 | enum blkio_policy_id plid) { } | ||
318 | 318 | ||
319 | static inline void *blkg_to_pdata(struct blkio_group *blkg, | 319 | static inline void *blkg_to_pdata(struct blkio_group *blkg, |
320 | struct blkio_policy_type *pol) { return NULL; } | 320 | struct blkio_policy_type *pol) { return NULL; } |
@@ -382,8 +382,7 @@ extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); | |||
382 | extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk); | 382 | extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk); |
383 | extern int blkiocg_del_blkio_group(struct blkio_group *blkg); | 383 | extern int blkiocg_del_blkio_group(struct blkio_group *blkg); |
384 | extern struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, | 384 | extern struct blkio_group *blkg_lookup(struct blkio_cgroup *blkcg, |
385 | struct request_queue *q, | 385 | struct request_queue *q); |
386 | enum blkio_policy_id plid); | ||
387 | struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg, | 386 | struct blkio_group *blkg_lookup_create(struct blkio_cgroup *blkcg, |
388 | struct request_queue *q, | 387 | struct request_queue *q, |
389 | enum blkio_policy_id plid, | 388 | enum blkio_policy_id plid, |