Commit 85b6bc9d authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe
Browse files

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: default avatarTejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 24f29046
...@@ -452,13 +452,6 @@ static void throtl_pd_reset_stats(struct blkg_policy_data *pd) ...@@ -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, static struct throtl_grp *throtl_lookup_tg(struct throtl_data *td,
struct blkcg *blkcg) 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)); return blkg_to_tg(blkg_lookup(blkcg, td->queue));
} }
......
...@@ -249,6 +249,9 @@ static inline struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg, ...@@ -249,6 +249,9 @@ static inline struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg,
{ {
struct blkcg_gq *blkg; struct blkcg_gq *blkg;
if (blkcg == &blkcg_root)
return q->root_blkg;
blkg = rcu_dereference(blkcg->blkg_hint); blkg = rcu_dereference(blkcg->blkg_hint);
if (blkg && blkg->q == q) if (blkg && blkg->q == q)
return blkg; return blkg;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment