[PATCH v2 1/2] block: don't request a module for the none elevator
From: Qiliang Yuan
Date: Sat Nov 14 2026 - 20:59:04 EST
elv_iosched_store() calls elv_iosched_load_module() for the requested
name before anything else, and loads "<name>-iosched" if no elevator
type of that name is registered. "none" never is, so every write of
"none" to queue/scheduler ends up in request_module("none-iosched").
That runs a modprobe helper which can never find the module, and adds
several milliseconds to every switch to "none", including rewrites of
it by udev rules or tuning tools that set the scheduler on each disk.
Return early for "none", like elevator_change() did before the module
loading moved into elv_iosched_load_module().
Writing queue/scheduler of a null_blk disk 20 times takes (median):
operation before (ms) after (ms) change
none -> none 13.10 9.11 -30%
mq-deadline -> none 13.00 7.97 -39%
Fixes: 734e1a8603128 ("block: Prevent deadlocks when switching elevators")
Signed-off-by: Qiliang Yuan <qiliang.yuan@xxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Nilay Shroff <nilay@xxxxxxxxxxxxx>
---
block/elevator.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/elevator.c b/block/elevator.c
index 66edf1a5768a8..9d9b2e84a1288 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -775,6 +775,9 @@ static void elv_iosched_load_module(const char *elevator_name)
{
struct elevator_type *found;
+ if (!strncmp(elevator_name, "none", 4))
+ return;
+
spin_lock(&elv_list_lock);
found = __elevator_find(elevator_name);
spin_unlock(&elv_list_lock);
--
2.43.0