All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: linux-block@vger.kernel.org
Cc: Matthew Wilcox <willy@infradead.org>
Subject: [PATCH 03/14] blk-cgroup: Reduce scope of blkg_array lock
Date: Mon, 18 Mar 2019 12:48:10 -0700	[thread overview]
Message-ID: <20190318194821.3470-4-willy@infradead.org> (raw)
In-Reply-To: <20190318194821.3470-1-willy@infradead.org>

We can now take and release the blkg_array lock within blkg_destroy()
instead of forcing the caller to hold it across the call.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
---
 block/blk-cgroup.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index bd6eea0587fb..6962e2fc612d 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -367,7 +367,6 @@ static void blkg_destroy(struct blkcg_gq *blkg)
 	int i;
 
 	lockdep_assert_held(&blkg->q->queue_lock);
-	lockdep_assert_held(&blkcg->blkg_array.xa_lock);
 
 	/* Something wrong if we are trying to remove same group twice */
 	WARN_ON_ONCE(list_empty(&blkg->q_node));
@@ -386,7 +385,7 @@ static void blkg_destroy(struct blkcg_gq *blkg)
 
 	blkg->online = false;
 
-	__xa_erase(&blkcg->blkg_array, blkg->q->id);
+	xa_erase(&blkcg->blkg_array, blkg->q->id);
 	list_del_init(&blkg->q_node);
 
 	/*
@@ -416,11 +415,7 @@ static void blkg_destroy_all(struct request_queue *q)
 
 	spin_lock_irq(&q->queue_lock);
 	list_for_each_entry_safe(blkg, n, &q->blkg_list, q_node) {
-		struct blkcg *blkcg = blkg->blkcg;
-
-		xa_lock(&blkcg->blkg_array);
 		blkg_destroy(blkg);
-		xa_unlock(&blkcg->blkg_array);
 	}
 
 	q->root_blkg = NULL;
@@ -1080,9 +1075,7 @@ void blkcg_destroy_blkgs(struct blkcg *blkcg)
 		struct request_queue *q = blkg->q;
 
 		spin_lock_irq(&q->queue_lock);
-		xa_lock(&blkcg->blkg_array);
 		blkg_destroy(blkg);
-		xa_unlock(&blkcg->blkg_array);
 		spin_unlock_irq(&q->queue_lock);
 	}
 }
-- 
2.20.1


  parent reply	other threads:[~2019-03-18 19:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 19:48 [PATCH 00/14] Convert block layer & drivers to XArray Matthew Wilcox
2019-03-18 19:48 ` [PATCH 01/14] blk-cgroup: Convert " Matthew Wilcox
2019-03-18 19:48 ` [PATCH 02/14] blk-cgroup: Remove blkg_list hlist Matthew Wilcox
2019-03-18 19:48 ` Matthew Wilcox [this message]
2019-03-18 19:48 ` [PATCH 04/14] blk-ioc: Convert to XArray Matthew Wilcox
2019-03-18 19:48 ` [PATCH 05/14] blk-ioc: Remove ioc's icq_list Matthew Wilcox
2019-03-18 19:48 ` [PATCH 06/14] genhd: Convert to XArray Matthew Wilcox
2019-03-18 19:48 ` [PATCH 07/14] bsg: Convert bsg_minor_idr " Matthew Wilcox
2019-03-18 19:48 ` [PATCH 08/14] brd: Convert " Matthew Wilcox
2019-03-18 19:48 ` [PATCH 09/14] null_blk: " Matthew Wilcox
2019-03-18 19:48 ` [PATCH 10/14] loop: Convert loop_index_idr " Matthew Wilcox
2019-03-18 19:48 ` [PATCH 11/14] nbd: Convert nbd_index_idr " Matthew Wilcox
2019-03-18 19:48 ` [PATCH 12/14] zram: Convert zram_index_idr " Matthew Wilcox
2019-03-18 19:48 ` [PATCH 13/14] drbd: Convert drbd devices " Matthew Wilcox
2019-03-18 19:48 ` [PATCH 14/14] drbd: Convert peer " Matthew Wilcox

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=20190318194821.3470-4-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=linux-block@vger.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 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.