Patch "elevator: do not request_module if elevator exists" has been added to the 6.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    elevator: do not request_module if elevator exists

to the 6.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     elevator-do-not-request_module-if-elevator-exists.patch
and it can be found in the queue-6.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit adc2ce0604e5a56670f1fa24f21c44379dc728c5
Author: Breno Leitao <leitao@xxxxxxxxxx>
Date:   Fri Oct 11 10:01:21 2024 -0700

    elevator: do not request_module if elevator exists
    
    [ Upstream commit b4ff6e93bfd0093ce3ffc7322e89fbaa8300488f ]
    
    Whenever an I/O elevator is changed, the system attempts to load a
    module for the new elevator. This occurs regardless of whether the
    elevator is already loaded or built directly into the kernel. This
    behavior introduces unnecessary overhead and potential issues.
    
    This makes the operation slower, and more error-prone. For instance,
    making the problem fixed by [1] visible for users that doesn't even rely
    on modules being available through modules.
    
    Do not try to load the ioscheduler if it is already visible.
    
    This change brings two main benefits: it improves the performance of
    elevator changes, and it reduces the likelihood of errors occurring
    during this process.
    
    [1] Commit e3accac1a976 ("block: Fix elv_iosched_local_module handling of "none" scheduler")
    
    Fixes: 734e1a860312 ("block: Prevent deadlocks when switching elevators")
    Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241011170122.3880087-1-leitao@xxxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/elevator.c b/block/elevator.c
index 4122026b11f1a..8f155512bcd84 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -709,13 +709,21 @@ int elv_iosched_load_module(struct gendisk *disk, const char *buf,
 			    size_t count)
 {
 	char elevator_name[ELV_NAME_MAX];
+	struct elevator_type *found;
+	const char *name;
 
 	if (!elv_support_iosched(disk->queue))
 		return -EOPNOTSUPP;
 
 	strscpy(elevator_name, buf, sizeof(elevator_name));
+	name = strstrip(elevator_name);
 
-	request_module("%s-iosched", strstrip(elevator_name));
+	spin_lock(&elv_list_lock);
+	found = __elevator_find(name);
+	spin_unlock(&elv_list_lock);
+
+	if (!found)
+		request_module("%s-iosched", name);
 
 	return 0;
 }




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux