From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: tj@kernel.org, linux-block@vger.kernel.org
Subject: [PATCH] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep
Date: Tue, 27 Sep 2022 08:54:25 +0200 [thread overview]
Message-ID: <20220927065425.257876-1-hch@lst.de> (raw)
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>
---
block/blk-cgroup.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 94af5f3f3620b..6a5c849ee061b 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -263,14 +263,6 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct gendisk *disk,
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);
--
2.30.2
next reply other threads:[~2022-09-27 6:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 6:54 Christoph Hellwig [this message]
2022-09-27 17:44 ` [PATCH] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep Tejun Heo
2022-09-27 17:54 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220927065425.257876-1-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox