From 136bbfd757c34ca5d0f4b19c767a2004acc4dea3 Mon Sep 17 00:00:00 2001 From: ztc1997 Date: Thu, 29 Aug 2024 14:48:06 +0800 Subject: [PATCH] block: Add default I/O scheduler option --- block/Kconfig.iosched | 21 +++++++++++++++++++++ block/elevator.c | 10 +++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched index 0d81d4274..a8ab183d4 100755 --- a/block/Kconfig.iosched +++ b/block/Kconfig.iosched @@ -64,6 +64,27 @@ config MQ_IOSCHED_SSG_CGROUP help Control Group for SamSung Generic IO scheduler. +choice + prompt "Default mq I/O scheduler" + default MQ_DEADLINE_DEFAULT + help + Select the I/O scheduler which will be used by default. + config MQ_DEADLINE_DEFAULT + bool "MQ Deadline" + depends on MQ_IOSCHED_DEADLINE + config MQ_KYBER_DEFAULT + bool "MQ Kyber" + depends on MQ_IOSCHED_KYBER + config BFQ_DEFAULT + bool "BFQ" + depends on IOSCHED_BFQ + config MQ_SSG_DEFAULT + bool "SamSung Generic I/O scheduler" + depends on MQ_IOSCHED_SSG + config NONE_DEFAULT + bool "NONE" +endchoice + endmenu endif diff --git a/block/elevator.c b/block/elevator.c index 180493360..7338bae7d 100755 --- a/block/elevator.c +++ b/block/elevator.c @@ -681,7 +681,15 @@ void elevator_init_mq(struct request_queue *q) if (unlikely(q->elevator)) return; - if (!q->required_elevator_features) + if (IS_ENABLED(CONFIG_BFQ_DEFAULT)) { + e = elevator_get(q, "bfq", false); + } else if (IS_ENABLED(CONFIG_MQ_KYBER_DEFAULT)) { + e = elevator_get(q, "kyber", false); + } else if (IS_ENABLED(CONFIG_MQ_KYBER_DEFAULT)) { + e = elevator_get(q, "kyber", false); + } else if (IS_ENABLED(CONFIG_MQ_SSG_DEFAULT)) { + e = elevator_get(q, "ssg", false); + } else if (!q->required_elevator_features) e = elevator_get_default(q); else e = elevator_get_by_features(q);