Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
From: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Marcos Paulo de Souza <marcos.souza.org@gmail.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org (open list:BLOCK LAYER)
Subject: [PATCH] block: elevator.c: Check elevator kernel argument again
Date: Sat, 13 Jul 2019 00:52:21 -0300
Message-ID: <20190713035221.31508-1-marcos.souza.org@gmail.com> (raw)

Since the inclusion of blk-mq, elevator= kernel argument was not being
considered anymore, making it impossible to specify a specific elevator
at boot time as it was used before.

This is done by checking chosen_elevator global variable, which is
populated once elevator= kernel argument is passed. Without this patch,
mq-deadline is the only elevator that is can be used at boot time.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
---

 I found this issue while inspecting why noop scheduler was gone, and so I found
 that was now impossible to use a scheduler different from mq-deadeline.

 Am I missing something? Is this a desirable behavior?

 One more question: currently we can't specify a "none" scheduler, like it used
 to be "noop". This is also on purpose? If it's not, I can provide a patch for
 it.

 block/elevator.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/block/elevator.c b/block/elevator.c
index 2f17d66d0e61..41ce7ba099ba 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -601,7 +601,7 @@ int elevator_switch_mq(struct request_queue *q,
  */
 int elevator_init_mq(struct request_queue *q)
 {
-	struct elevator_type *e;
+	struct elevator_type *e = NULL;
 	int err = 0;
 
 	if (q->nr_hw_queues != 1)
@@ -615,9 +615,18 @@ int elevator_init_mq(struct request_queue *q)
 	if (unlikely(q->elevator))
 		goto out_unlock;
 
-	e = elevator_get(q, "mq-deadline", false);
-	if (!e)
-		goto out_unlock;
+	/* if elevator was used as kernel argument, try to load it */
+	if (*chosen_elevator) {
+		e = elevator_get(q, chosen_elevator, false);
+		if (!e)
+			pr_err("io scheduler %s not found", chosen_elevator);
+	}
+
+	if (!e) {
+		e = elevator_get(q, "mq-deadline", false);
+		if (!e)
+			goto out_unlock;
+	}
 
 	err = blk_mq_init_sched(q, e);
 	if (err)
-- 
2.22.0


             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-13  3:52 Marcos Paulo de Souza [this message]
2019-07-13 21:53 ` Jens Axboe
2019-07-14  4:01   ` Marcos Paulo de Souza

Reply instructions:

You may reply publically 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=20190713035221.31508-1-marcos.souza.org@gmail.com \
    --to=marcos.souza.org@gmail.com \
    --cc=axboe@kernel.dk \
    --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

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox