Skip to content

Commit 5765033

Browse files
Christoph Hellwigaxboe
authored andcommitted
blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep
blkg_conf_prep just creates a new blkg structure, there is no real need to update the lookup hint which should only be done on a successful lookup in the I/O path. Suggested-by: Tejun Heo <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Tejun Heo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 8237c01 commit 5765033

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

block/blk-cgroup.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,6 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct gendisk *disk,
263263
return NULL;
264264
}
265265

266-
static void blkg_update_hint(struct blkcg *blkcg, struct blkcg_gq *blkg)
267-
{
268-
lockdep_assert_held(&blkg->q->queue_lock);
269-
270-
if (blkcg != &blkcg_root && blkg != rcu_dereference(blkcg->blkg_hint))
271-
rcu_assign_pointer(blkcg->blkg_hint, blkg);
272-
}
273-
274266
/*
275267
* If @new_blkg is %NULL, this function tries to allocate a new one as
276268
* necessary using %GFP_NOWAIT. @new_blkg is always consumed on return.
@@ -383,7 +375,9 @@ static struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg,
383375
spin_lock_irqsave(&q->queue_lock, flags);
384376
blkg = blkg_lookup(blkcg, q);
385377
if (blkg) {
386-
blkg_update_hint(blkcg, blkg);
378+
if (blkcg != &blkcg_root &&
379+
blkg != rcu_dereference(blkcg->blkg_hint))
380+
rcu_assign_pointer(blkcg->blkg_hint, blkg);
387381
goto found;
388382
}
389383

@@ -680,10 +674,8 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
680674
}
681675

682676
blkg = blkg_lookup(blkcg, q);
683-
if (blkg) {
684-
blkg_update_hint(blkcg, blkg);
677+
if (blkg)
685678
goto success;
686-
}
687679

688680
/*
689681
* Create blkgs walking down from blkcg_root to @blkcg, so that all
@@ -727,7 +719,6 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
727719

728720
blkg = blkg_lookup(pos, q);
729721
if (blkg) {
730-
blkg_update_hint(pos, blkg);
731722
blkg_free(new_blkg);
732723
} else {
733724
blkg = blkg_create(pos, disk, new_blkg);

0 commit comments

Comments
 (0)