All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-block@vger.kernel.org, linux-nvme@lists.infrdead.org
Subject: [PATCH 02/12] blk-mq: factor out a helper to reise the block softirq
Date: Thu, 11 Jun 2020 08:44:42 +0200	[thread overview]
Message-ID: <20200611064452.12353-3-hch@lst.de> (raw)
In-Reply-To: <20200611064452.12353-1-hch@lst.de>

Add a helper to deduplicate the logic that raises the block softirq.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-mq.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index bbdc6c97bd42db..aa1917949f0ded 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -598,19 +598,27 @@ static __latent_entropy void blk_done_softirq(struct softirq_action *h)
 	}
 }
 
-#ifdef CONFIG_SMP
-static void trigger_softirq(void *data)
+static void blk_mq_trigger_softirq(struct request *rq)
 {
-	struct request *rq = data;
-	struct list_head *list;
+	struct list_head *list = this_cpu_ptr(&blk_cpu_done);
 
-	list = this_cpu_ptr(&blk_cpu_done);
 	list_add_tail(&rq->ipi_list, list);
 
+	/*
+	 * If the list only contains our just added request, signal a raise of
+	 * the softirq.  If there are already entries there, someone already
+	 * raised the irq but it hasn't run yet.
+	 */
 	if (list->next == &rq->ipi_list)
 		raise_softirq_irqoff(BLOCK_SOFTIRQ);
 }
 
+#ifdef CONFIG_SMP
+static void trigger_softirq(void *data)
+{
+	blk_mq_trigger_softirq(data);
+}
+
 /*
  * Setup and invoke a run of 'trigger_softirq' on the given cpu.
  */
@@ -681,19 +689,8 @@ static void __blk_complete_request(struct request *req)
 	 * avoids IPI sending from current CPU to the first CPU of a group.
 	 */
 	if (ccpu == cpu || shared) {
-		struct list_head *list;
 do_local:
-		list = this_cpu_ptr(&blk_cpu_done);
-		list_add_tail(&req->ipi_list, list);
-
-		/*
-		 * if the list only contains our just added request,
-		 * signal a raise of the softirq. If there are already
-		 * entries there, someone already raised the irq but it
-		 * hasn't run yet.
-		 */
-		if (list->next == &req->ipi_list)
-			raise_softirq_irqoff(BLOCK_SOFTIRQ);
+		blk_mq_trigger_softirq(req);
 	} else if (raise_blk_irq(ccpu, req))
 		goto do_local;
 
-- 
2.26.2


  parent reply	other threads:[~2020-06-11  6:45 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11  6:44 blk_mq_complete_request overhaul Christoph Hellwig
2020-06-11  6:44 ` [PATCH 01/12] blk-mq: merge blk-softirq.c into blk-mq.c Christoph Hellwig
2020-06-18 14:35   ` Daniel Wagner
2020-06-11  6:44 ` Christoph Hellwig [this message]
2020-06-18 14:34   ` [PATCH 02/12] blk-mq: factor out a helper to reise the block softirq Daniel Wagner
2020-06-18 14:37     ` Daniel Wagner
2020-06-18 14:37       ` Daniel Wagner
2020-06-18 14:50   ` Daniel Wagner
2020-06-18 14:50     ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 03/12] blk-mq: remove raise_blk_irq Christoph Hellwig
2020-06-18 15:02   ` Daniel Wagner
2020-06-18 15:02     ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 04/12] blk-mq: complete polled requests directly Christoph Hellwig
2020-06-18 15:50   ` Daniel Wagner
2020-06-18 15:50     ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 05/12] blk-mq: short cut the IPI path in blk_mq_force_complete_rq for !SMP Christoph Hellwig
2020-06-18 15:52   ` Daniel Wagner
2020-06-18 15:52     ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 06/12] blk-mq: merge the softirq vs non-softirq IPI logic Christoph Hellwig
2020-06-18 16:12   ` Daniel Wagner
2020-06-18 16:12     ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 07/12] blk-mq: move failure injection out of blk_mq_complete_request Christoph Hellwig
2020-06-18 16:18   ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 08/12] blk-mq: remove the get_cpu/put_cpu pair in blk_mq_complete_request Christoph Hellwig
2020-06-18 16:24   ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 09/12] blk-mq: factor out a blk_mq_complete_need_ipi helper Christoph Hellwig
2020-06-18 16:33   ` Daniel Wagner
2020-06-18 16:33     ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 10/12] blk-mq: add a new blk_mq_complete_request_remote API Christoph Hellwig
2020-06-18 16:39   ` Daniel Wagner
2020-06-18 16:39     ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 11/12] nvme-rdma: factor out a nvme_rdma_end_request helper Christoph Hellwig
2020-06-18 16:42   ` Daniel Wagner
2020-06-11  6:44 ` [PATCH 12/12] nvme: use blk_mq_complete_request_remote to avoid an indirect function call Christoph Hellwig
2020-06-18 16:47   ` Daniel Wagner
2020-06-18 16:47     ` Daniel Wagner
2020-06-18 14:11 ` blk_mq_complete_request overhaul Christoph Hellwig
2020-06-18 14:11   ` Christoph Hellwig
2020-06-18 14:54   ` Jens Axboe
2020-06-18 14:54     ` 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=20200611064452.12353-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infrdead.org \
    --cc=peterz@infradead.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.