From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-block@vger.kernel.org, linux-mmc@vger.kernel.org
Cc: tglx@linutronix.de, Ulf Hansson <ulf.hansson@linaro.org>,
Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@infradead.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH v3 1/2] blk-mq: Add blk_mq_complete_request_direct()
Date: Mon, 25 Oct 2021 09:06:57 +0200 [thread overview]
Message-ID: <20211025070658.1565848-2-bigeasy@linutronix.de> (raw)
In-Reply-To: <20211025070658.1565848-1-bigeasy@linutronix.de>
Add blk_mq_complete_request_direct() which completes the block request
directly instead deferring it to softirq for single queue devices.
This is useful for devices which complete the requests in preemptible
context and raising softirq from means scheduling ksoftirqd.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/blk-mq.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 13ba1861e688f..4c0bd305891aa 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -521,6 +521,17 @@ static inline void blk_mq_set_request_complete(struct request *rq)
WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
}
+/*
+ * Complete the request directly instead of deferring it to softirq or
+ * completing it another CPU. Useful in preemptible instead of an interrupt.
+ */
+static inline void blk_mq_complete_request_direct(struct request *rq,
+ void (*complete)(struct request *rq))
+{
+ WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
+ complete(rq);
+}
+
void blk_mq_start_request(struct request *rq);
void blk_mq_end_request(struct request *rq, blk_status_t error);
void __blk_mq_end_request(struct request *rq, blk_status_t error);
--
2.33.0
next prev parent reply other threads:[~2021-10-25 7:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 7:06 [PATCH v3 0/2] blk-mq: Allow to complete requests directly Sebastian Andrzej Siewior
2021-10-25 7:06 ` Sebastian Andrzej Siewior [this message]
2021-10-25 7:10 ` [PATCH v3 1/2] blk-mq: Add blk_mq_complete_request_direct() Christoph Hellwig
2021-10-25 7:06 ` [PATCH v3 2/2] mmc: core: Use blk_mq_complete_request_direct() Sebastian Andrzej Siewior
2021-11-25 11:52 ` [PATCH v3 0/2] blk-mq: Allow to complete requests directly Sebastian Andrzej Siewior
2021-11-25 16:02 ` 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=20211025070658.1565848-2-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=ulf.hansson@linaro.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