From: Jens Axboe <axboe@kernel.dk>
To: linux-block@vger.kernel.org
Cc: hch@lst.de, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 3/6] block: get rid of plug list sorting
Date: Mon, 18 Oct 2021 11:51:06 -0600 [thread overview]
Message-ID: <20211018175109.401292-4-axboe@kernel.dk> (raw)
In-Reply-To: <20211018175109.401292-1-axboe@kernel.dk>
Even if we have multiple queues in the plug list, chances that they
are very interspersed is minimal. Don't bother spending CPU cycles
sorting the list.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
block/blk-mq.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index d957b6812a98..58774267dd95 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -19,7 +19,6 @@
#include <linux/smp.h>
#include <linux/interrupt.h>
#include <linux/llist.h>
-#include <linux/list_sort.h>
#include <linux/cpu.h>
#include <linux/cache.h>
#include <linux/sched/sysctl.h>
@@ -2151,20 +2150,6 @@ void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,
spin_unlock(&ctx->lock);
}
-static int plug_rq_cmp(void *priv, const struct list_head *a,
- const struct list_head *b)
-{
- struct request *rqa = container_of(a, struct request, queuelist);
- struct request *rqb = container_of(b, struct request, queuelist);
-
- if (rqa->mq_ctx != rqb->mq_ctx)
- return rqa->mq_ctx > rqb->mq_ctx;
- if (rqa->mq_hctx != rqb->mq_hctx)
- return rqa->mq_hctx > rqb->mq_hctx;
-
- return blk_rq_pos(rqa) > blk_rq_pos(rqb);
-}
-
void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
{
LIST_HEAD(list);
@@ -2172,10 +2157,6 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
if (list_empty(&plug->mq_list))
return;
list_splice_init(&plug->mq_list, &list);
-
- if (plug->rq_count > 2 && plug->multiple_queues)
- list_sort(NULL, &list, plug_rq_cmp);
-
plug->rq_count = 0;
do {
--
2.33.1
next prev parent reply other threads:[~2021-10-18 17:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 17:51 [PATCHSET v2 0/6] Various block layer optimizations Jens Axboe
2021-10-18 17:51 ` [PATCH 1/6] block: don't call blk_status_to_errno in blk_update_request Jens Axboe
2021-10-18 17:51 ` [PATCH 2/6] block: return whether or not to unplug through boolean Jens Axboe
2021-10-18 18:00 ` Christoph Hellwig
2021-10-18 17:51 ` Jens Axboe [this message]
2021-10-18 18:00 ` [PATCH 3/6] block: get rid of plug list sorting Christoph Hellwig
2021-10-18 17:51 ` [PATCH 4/6] block: change plugging to use a singly linked list Jens Axboe
2021-10-19 5:57 ` Christoph Hellwig
2021-10-19 11:58 ` Jens Axboe
2021-10-18 17:51 ` [PATCH 5/6] block: move blk_mq_tag_to_rq() inline Jens Axboe
2021-10-18 18:01 ` Christoph Hellwig
2021-10-18 17:51 ` [PATCH 6/6] block: align blkdev_dio inlined bio to a cacheline Jens Axboe
2021-10-18 18:01 ` Christoph Hellwig
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=20211018175109.401292-4-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=hch@lst.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).