diff options
author | Tejun Heo <tj@kernel.org> | 2015-08-18 17:55:18 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-08-18 18:49:17 -0400 |
commit | 85b6bc9db6d5ab6980b43c38b5cbd11d24414ce4 (patch) | |
tree | 7389d8656738b72cc7c8c7569247db31800d9246 | |
parent | 24f290466f79a6497f1654f64b9a841872cba3ca (diff) |
blkcg: move root blkg lookup optimization from throtl_lookup_tg() to __blkg_lookup()
Currently, both throttle and cfq policies implement their own root
blkg (blkcg_gq) lookup fast path. This patch moves root blkg
optimization from throtl_lookup_tg() to __blkg_lookup(). cfq-iosched
currently doesn't use blkg_lookup() but will be converted and drop the
optimization too.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | block/blk-throttle.c | 7 | ||||
-rw-r--r-- | include/linux/blk-cgroup.h | 3 |
2 files changed, 3 insertions, 7 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index c2c75477a6b2..1f63fc834dc3 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -452,13 +452,6 @@ static void throtl_pd_reset_stats(struct blkg_policy_data *pd) | |||
452 | static struct throtl_grp *throtl_lookup_tg(struct throtl_data *td, | 452 | static struct throtl_grp *throtl_lookup_tg(struct throtl_data *td, |
453 | struct blkcg *blkcg) | 453 | struct blkcg *blkcg) |
454 | { | 454 | { |
455 | /* | ||
456 | * This is the common case when there are no blkcgs. Avoid lookup | ||
457 | * in this case | ||
458 | */ | ||
459 | if (blkcg == &blkcg_root) | ||
460 | return td_root_tg(td); | ||
461 | |||
462 | return blkg_to_tg(blkg_lookup(blkcg, td->queue)); | 455 | return blkg_to_tg(blkg_lookup(blkcg, td->queue)); |
463 | } | 456 | } |
464 | 457 | ||
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index d5b54aa50582..0609bce69f68 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h | |||
@@ -249,6 +249,9 @@ static inline struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg, | |||
249 | { | 249 | { |
250 | struct blkcg_gq *blkg; | 250 | struct blkcg_gq *blkg; |
251 | 251 | ||
252 | if (blkcg == &blkcg_root) | ||
253 | return q->root_blkg; | ||
254 | |||
252 | blkg = rcu_dereference(blkcg->blkg_hint); | 255 | blkg = rcu_dereference(blkcg->blkg_hint); |
253 | if (blkg && blkg->q == q) | 256 | if (blkg && blkg->q == q) |
254 | return blkg; | 257 | return blkg; |