All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep
@ 2022-09-27  6:54 Christoph Hellwig
  2022-09-27 17:44 ` Tejun Heo
  2022-09-27 17:54 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-09-27  6:54 UTC (permalink / raw)
  To: axboe; +Cc: tj, linux-block

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep
  2022-09-27  6:54 [PATCH] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep Christoph Hellwig
@ 2022-09-27 17:44 ` Tejun Heo
  2022-09-27 17:54 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2022-09-27 17:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: axboe, linux-block

On Tue, Sep 27, 2022 at 08:54:25AM +0200, Christoph Hellwig wrote:
> 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>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep
  2022-09-27  6:54 [PATCH] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep Christoph Hellwig
  2022-09-27 17:44 ` Tejun Heo
@ 2022-09-27 17:54 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-09-27 17:54 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: tj, linux-block

On Tue, 27 Sep 2022 08:54:25 +0200, Christoph Hellwig wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep
      commit: 5765033cf77c54897848df683420bb62b6cc3d05

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-27 17:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27  6:54 [PATCH] blk-cgroup: don't update the blkg lookup hint in blkg_conf_prep Christoph Hellwig
2022-09-27 17:44 ` Tejun Heo
2022-09-27 17:54 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.