]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
blkcg: move root blkg lookup optimization from throtl_lookup_tg() to __blkg_lookup()
authorTejun Heo <tj@kernel.org>
Tue, 18 Aug 2015 21:55:18 +0000 (14:55 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 18 Aug 2015 22:49:17 +0000 (15:49 -0700)
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>
block/blk-throttle.c
include/linux/blk-cgroup.h

index c2c75477a6b20491e4fea5ea2c9cffa9a27df583..1f63fc834dc3e6dab428ead1a0daee3b56574059 100644 (file)
@@ -452,13 +452,6 @@ static void throtl_pd_reset_stats(struct blkg_policy_data *pd)
 static struct throtl_grp *throtl_lookup_tg(struct throtl_data *td,
                                           struct blkcg *blkcg)
 {
-       /*
-        * This is the common case when there are no blkcgs.  Avoid lookup
-        * in this case
-        */
-       if (blkcg == &blkcg_root)
-               return td_root_tg(td);
-
        return blkg_to_tg(blkg_lookup(blkcg, td->queue));
 }
 
index d5b54aa50582f0b010dfcd24e0e69bb43b65ee70..0609bce69f68ff7c3407ebd47ef5214c0bbee97b 100644 (file)
@@ -249,6 +249,9 @@ static inline struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg,
 {
        struct blkcg_gq *blkg;
 
+       if (blkcg == &blkcg_root)
+               return q->root_blkg;
+
        blkg = rcu_dereference(blkcg->blkg_hint);
        if (blkg && blkg->q == q)
                return blkg;