Skip to content

Commit 85b6bc9

Browse files
htejunaxboe
authored andcommitted
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>
1 parent 24f2904 commit 85b6bc9

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

block/blk-throttle.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,6 @@ static void throtl_pd_reset_stats(struct blkg_policy_data *pd)
452452
static struct throtl_grp *throtl_lookup_tg(struct throtl_data *td,
453453
struct blkcg *blkcg)
454454
{
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-
462455
return blkg_to_tg(blkg_lookup(blkcg, td->queue));
463456
}
464457

include/linux/blk-cgroup.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ static inline struct blkcg_gq *__blkg_lookup(struct blkcg *blkcg,
249249
{
250250
struct blkcg_gq *blkg;
251251

252+
if (blkcg == &blkcg_root)
253+
return q->root_blkg;
254+
252255
blkg = rcu_dereference(blkcg->blkg_hint);
253256
if (blkg && blkg->q == q)
254257
return blkg;

0 commit comments

Comments
 (0)