summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-09-27 08:54:25 +0200
committerJens Axboe <axboe@kernel.dk>2022-09-27 11:50:05 -0600
commit5765033cf77c54897848df683420bb62b6cc3d05 (patch)
tree15ae842e84983808842f3b1ad47397093d3a7370 /block
parent8237c01f1696bc53c470493bf1fe092a107648a6 (diff)
downloadlinux-5765033cf77c54897848df683420bb62b6cc3d05.tar.gz
linux-5765033cf77c54897848df683420bb62b6cc3d05.tar.bz2
linux-5765033cf77c54897848df683420bb62b6cc3d05.zip
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 <tj@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20220927065425.257876-1-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-cgroup.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 94af5f3f3620..6a5c849ee061 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -263,14 +263,6 @@ err_free:
return NULL;
}
-static void blkg_update_hint(struct blkcg *blkcg, struct blkcg_gq *blkg)
-{
- lockdep_assert_held(&blkg->q->queue_lock);
-
- if (blkcg != &blkcg_root && blkg != rcu_dereference(blkcg->blkg_hint))
- rcu_assign_pointer(blkcg->blkg_hint, blkg);
-}
-
/*
* If @new_blkg is %NULL, this function tries to allocate a new one as
* 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,
spin_lock_irqsave(&q->queue_lock, flags);
blkg = blkg_lookup(blkcg, q);
if (blkg) {
- blkg_update_hint(blkcg, blkg);
+ if (blkcg != &blkcg_root &&
+ blkg != rcu_dereference(blkcg->blkg_hint))
+ rcu_assign_pointer(blkcg->blkg_hint, blkg);
goto found;
}
@@ -680,10 +674,8 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
}
blkg = blkg_lookup(blkcg, q);
- if (blkg) {
- blkg_update_hint(blkcg, blkg);
+ if (blkg)
goto success;
- }
/*
* 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,
blkg = blkg_lookup(pos, q);
if (blkg) {
- blkg_update_hint(pos, blkg);
blkg_free(new_blkg);
} else {
blkg = blkg_create(pos, disk, new_blkg);