public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: axboe@kernel.dk, hongyu.jin.cn@gmail.com
Cc: ebiggers@kernel.org, dm-devel@lists.linux.dev,
	linux-block@vger.kernel.org, Hongyu Jin <hongyu.jin@unisoc.com>,
	Eric Biggers <ebiggers@google.com>,
	Mikulas Patocka <mpatocka@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>
Subject: [PATCH v9 5/5] dm crypt: Fix IO priority lost when queuing write bios
Date: Tue, 30 Jan 2024 15:26:38 -0500	[thread overview]
Message-ID: <20240130202638.62600-6-snitzer@kernel.org> (raw)
In-Reply-To: <20240130202638.62600-1-snitzer@kernel.org>

From: Hongyu Jin <hongyu.jin@unisoc.com>

Since dm-crypt queues writes to a different kernel thread (workqueue),
the bios will dispatch from tasks with different io_context->ioprio
settings and blkcg than the submitting task, thus giving incorrect
ioprio to the io scheduler.

Get the original IO priority setting via struct dm_crypt_io::base_bio
and set this priority in the bio for write.

Link: https://lore.kernel.org/dm-devel/alpine.LRH.2.11.1612141049250.13402@mail.ewheeler.net

Signed-off-by: Hongyu Jin <hongyu.jin@unisoc.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
 drivers/md/dm-crypt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index ab1e30630e64..2b4671d15201 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1683,6 +1683,7 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned int size)
 				 GFP_NOIO, &cc->bs);
 	clone->bi_private = io;
 	clone->bi_end_io = crypt_endio;
+	clone->bi_ioprio = io->base_bio->bi_ioprio;
 
 	remaining_size = size;
 
-- 
2.40.0


  parent reply	other threads:[~2024-01-30 20:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30 20:26 [PATCH v9 0/5] Fix I/O priority lost in device-mapper Mike Snitzer
2024-01-30 20:26 ` [PATCH v9 1/5] block: Fix where bio IO priority gets set Mike Snitzer
2024-02-01  3:19   ` Ming Lei
2024-01-30 20:26 ` [PATCH v9 2/5] dm io: Support IO priority Mike Snitzer
2024-01-30 20:26 ` [PATCH v9 3/5] dm bufio: " Mike Snitzer
2024-01-30 20:26 ` [PATCH v9 4/5] dm verity: Fix IO priority lost when reading FEC and hash Mike Snitzer
2024-01-30 20:26 ` Mike Snitzer [this message]
2024-02-01 18:00 ` (subset) [PATCH v9 0/5] Fix I/O priority lost in device-mapper 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=20240130202638.62600-6-snitzer@kernel.org \
    --to=snitzer@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@google.com \
    --cc=ebiggers@kernel.org \
    --cc=hongyu.jin.cn@gmail.com \
    --cc=hongyu.jin@unisoc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mpatocka@redhat.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