aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.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/cfq-iosched.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/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index dc73690dec44..393eaa59913b 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3462,15 +3462,13 @@ static void cfq_exit_queue(struct elevator_queue *e)
3462 3462
3463 spin_unlock_irq(q->queue_lock); 3463 spin_unlock_irq(q->queue_lock);
3464 3464
3465 blkg_destroy_all(q, BLKIO_POLICY_PROP, true);
3466
3467#ifdef CONFIG_BLK_CGROUP 3465#ifdef CONFIG_BLK_CGROUP
3468 /* 3466 /*
3469 * If there are groups which we could not unlink from blkcg list, 3467 * If there are groups which we could not unlink from blkcg list,
3470 * wait for a rcu period for them to be freed. 3468 * wait for a rcu period for them to be freed.
3471 */ 3469 */
3472 spin_lock_irq(q->queue_lock); 3470 spin_lock_irq(q->queue_lock);
3473 wait = q->nr_blkgs[BLKIO_POLICY_PROP]; 3471 wait = q->nr_blkgs;
3474 spin_unlock_irq(q->queue_lock); 3472 spin_unlock_irq(q->queue_lock);
3475#endif 3473#endif
3476 cfq_shutdown_timer_wq(cfqd); 3474 cfq_shutdown_timer_wq(cfqd);
@@ -3492,6 +3490,7 @@ static void cfq_exit_queue(struct elevator_queue *e)
3492#ifndef CONFIG_CFQ_GROUP_IOSCHED 3490#ifndef CONFIG_CFQ_GROUP_IOSCHED
3493 kfree(cfqd->root_group); 3491 kfree(cfqd->root_group);
3494#endif 3492#endif
3493 update_root_blkg_pd(q, BLKIO_POLICY_PROP);
3495 kfree(cfqd); 3494 kfree(cfqd);
3496} 3495}
3497 3496