All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khazhismel Kumykov <khazhy@chromium.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Khazhismel Kumykov <khazhy@google.com>
Subject: [PATCH] block: allow specifying default iosched in config
Date: Mon, 26 Sep 2022 15:01:34 -0700	[thread overview]
Message-ID: <20220926220134.2633692-1-khazhy@google.com> (raw)

Setting IO scheduler at device init time in kernel is useful, and moving
this option into kernel config makes it possible to build different
kernels with different default schedulers from the same tree.

Order deadline->none->rest to retain current behavior of using "none" by
default if mq-deadline is not enabled.

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
---
checkpatch suggested more verbose help descriptions, but I felt it'd be
too much repeated from the main config options, so opted to leave them
out.

 block/Kconfig.iosched | 28 ++++++++++++++++++++++++++++
 block/elevator.c      |  2 +-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched
index 615516146086..38a83282802a 100644
--- a/block/Kconfig.iosched
+++ b/block/Kconfig.iosched
@@ -43,4 +43,32 @@ config BFQ_CGROUP_DEBUG
 	Enable some debugging help. Currently it exports additional stat
 	files in a cgroup which can be useful for debugging.
 
+choice
+	prompt "Default I/O scheduler"
+	default DEFAULT_MQ_DEADLINE
+	help
+	  Select the I/O scheduler which will be used by default for block devices
+	  with a single hardware queue.
+
+config DEFAULT_MQ_DEADLINE
+	bool "MQ Deadline" if MQ_IOSCHED_DEADLINE=y
+
+config DEFAULT_NONE
+	bool "none"
+
+config DEFAULT_MQ_KYBER
+	bool "Kyber" if MQ_IOSCHED_KYBER=y
+
+config DEFAULT_BFQ
+	bool "BFQ" if IOSCHED_BFQ=y
+
+endchoice
+
+config MQ_DEFAULT_IOSCHED
+	string
+	default "mq-deadline" if DEFAULT_MQ_DEADLINE
+	default "none" if DEFAULT_NONE
+	default "kyber" if DEFAULT_MQ_KYBER
+	default "bfq" if DEFAULT_BFQ
+
 endmenu
diff --git a/block/elevator.c b/block/elevator.c
index c319765892bb..4137933dfd16 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -642,7 +642,7 @@ static struct elevator_type *elevator_get_default(struct request_queue *q)
 	    !blk_mq_is_shared_tags(q->tag_set->flags))
 		return NULL;
 
-	return elevator_get(q, "mq-deadline", false);
+	return elevator_get(q, CONFIG_MQ_DEFAULT_IOSCHED, false);
 }
 
 /*
-- 
2.37.3.998.g577e59143f-goog


             reply	other threads:[~2022-09-26 22:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 22:01 Khazhismel Kumykov [this message]
2022-09-26 22:16 ` [PATCH] block: allow specifying default iosched in config Chaitanya Kulkarni
2022-10-03 23:02   ` Khazhy Kumykov
2022-10-04  6:12 ` Damien Le Moal
2022-10-04 18:33   ` Khazhy Kumykov
2022-10-04 22:40     ` Damien Le Moal
2022-10-04 23:15       ` Khazhy Kumykov
2022-10-10  7:20         ` Christoph Hellwig
2022-10-17 17:22           ` Khazhy Kumykov
2022-10-18  8:27             ` Christoph Hellwig
2022-10-04 16:42 ` Jens Axboe
2022-10-04 20:22   ` 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=20220926220134.2633692-1-khazhy@google.com \
    --to=khazhy@chromium.org \
    --cc=axboe@kernel.dk \
    --cc=khazhy@google.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@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 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.