Skip to content

Commit

Permalink
blkcg: move root blkg lookup optimization from throtl_lookup_tg() to …
Browse files Browse the repository at this point in the history
…__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>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Aug 18, 2015
1 parent 24f2904 commit 85b6bc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 0 additions & 7 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
3 changes: 3 additions & 0 deletions include/linux/blk-cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 85b6bc9

Please sign in to comment.