aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-throttle.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-03-05 16:15:20 -0500
committerJens Axboe <axboe@kernel.dk>2012-03-06 15:27:23 -0500
commite8989fae38d9831c72b20375a206a919ca468c52 (patch)
tree2eeb1320e526cd0ba187465c0e6e19799dc1b956 /block/blk-throttle.c
parent03aa264ac15637b6f98374270bcdf31400965505 (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-throttle.c')
-rw-r--r--block/blk-throttle.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 132941260e58..e35ee7aeea69 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -167,7 +167,7 @@ throtl_grp *throtl_lookup_tg(struct throtl_data *td, struct blkio_cgroup *blkcg)
167 if (blkcg == &blkio_root_cgroup) 167 if (blkcg == &blkio_root_cgroup)
168 return td->root_tg; 168 return td->root_tg;
169 169
170 return blkg_to_tg(blkg_lookup(blkcg, td->queue, BLKIO_POLICY_THROTL)); 170 return blkg_to_tg(blkg_lookup(blkcg, td->queue));
171} 171}
172 172
173static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td, 173static struct throtl_grp *throtl_lookup_create_tg(struct throtl_data *td,
@@ -704,8 +704,7 @@ static void throtl_process_limit_change(struct throtl_data *td)
704 704
705 throtl_log(td, "limits changed"); 705 throtl_log(td, "limits changed");
706 706
707 list_for_each_entry_safe(blkg, n, &q->blkg_list[BLKIO_POLICY_THROTL], 707 list_for_each_entry_safe(blkg, n, &q->blkg_list, q_node) {
708 q_node[BLKIO_POLICY_THROTL]) {
709 struct throtl_grp *tg = blkg_to_tg(blkg); 708 struct throtl_grp *tg = blkg_to_tg(blkg);
710 709
711 if (!tg->limits_changed) 710 if (!tg->limits_changed)
@@ -1054,11 +1053,9 @@ void blk_throtl_exit(struct request_queue *q)
1054 1053
1055 throtl_shutdown_wq(q); 1054 throtl_shutdown_wq(q);
1056 1055
1057 blkg_destroy_all(q, BLKIO_POLICY_THROTL, true);
1058
1059 /* If there are other groups */ 1056 /* If there are other groups */
1060 spin_lock_irq(q->queue_lock); 1057 spin_lock_irq(q->queue_lock);
1061 wait = q->nr_blkgs[BLKIO_POLICY_THROTL]; 1058 wait = q->nr_blkgs;
1062 spin_unlock_irq(q->queue_lock); 1059 spin_unlock_irq(q->queue_lock);
1063 1060
1064 /* 1061 /*