Linux Device Mapper development
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: dm-devel@redhat.com
Cc: keescook@chromium.org, heinzm@redhat.com,
	Mike Snitzer <snitzer@kernel.org>,
	nhuck@google.com, ebiggers@kernel.org, ejt@redhat.com,
	mpatocka@redhat.com, luomeng12@huawei.com
Subject: [dm-devel] [dm-6.4 PATCH 8/8] dm thin: speed up cell_defer_no_holder()
Date: Wed, 22 Mar 2023 14:18:45 -0400	[thread overview]
Message-ID: <20230322181845.29848-9-snitzer@kernel.org> (raw)
In-Reply-To: <20230322181845.29848-1-snitzer@kernel.org>

From: Joe Thornber <ejt@redhat.com>

Reduce the time that a spinlock is held in cell_defer_no_holder().

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
 drivers/md/dm-thin.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 286e4d9e45c8..583159dc8084 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -883,15 +883,17 @@ static void cell_defer_no_holder(struct thin_c *tc, struct dm_bio_prison_cell *c
 {
 	struct pool *pool = tc->pool;
 	unsigned long flags;
-	int has_work;
+	struct bio_list bios;
 
-	spin_lock_irqsave(&tc->lock, flags);
-	cell_release_no_holder(pool, cell, &tc->deferred_bio_list);
-	has_work = !bio_list_empty(&tc->deferred_bio_list);
-	spin_unlock_irqrestore(&tc->lock, flags);
+	bio_list_init(&bios);
+	cell_release_no_holder(pool, cell, &bios);
 
-	if (has_work)
+	if (!bio_list_empty(&bios)) {
+		spin_lock_irqsave(&tc->lock, flags);
+		bio_list_merge(&tc->deferred_bio_list, &bios);
+		spin_unlock_irqrestore(&tc->lock, flags);
 		wake_worker(pool);
+	}
 }
 
 static void thin_defer_bio(struct thin_c *tc, struct bio *bio);
-- 
2.40.0

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


      parent reply	other threads:[~2023-03-22 18:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 18:18 [dm-devel] [dm-6.4 PATCH 0/8] dm bufio, thin: improve concurrent IO performance Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 1/8] dm: split discards further if target sets max_discard_granularity Mike Snitzer
2023-03-23  8:00   ` Joe Thornber
2023-03-23  8:45     ` Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 2/8] dm bio prison v1: improve concurrent IO performance Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 3/8] dm bufio: remove unused dm_bufio_release_move interface Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 4/8] dm bufio: move dm_buffer struct Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 5/8] dm bufio: improve concurrent IO performance Mike Snitzer
2023-03-23  7:51   ` Joe Thornber
2023-03-23  9:51     ` Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 6/8] dm bufio: move dm_bufio_client members to avoid spanning cachelines Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 7/8] dm bufio: rename buffer_cache struct to dm_buffer_cache Mike Snitzer
2023-03-22 18:18 ` Mike Snitzer [this message]

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=20230322181845.29848-9-snitzer@kernel.org \
    --to=snitzer@kernel.org \
    --cc=dm-devel@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=ejt@redhat.com \
    --cc=heinzm@redhat.com \
    --cc=keescook@chromium.org \
    --cc=luomeng12@huawei.com \
    --cc=mpatocka@redhat.com \
    --cc=nhuck@google.com \
    /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