[RFT 4/5] module: use list_add_tail_rcu() when adding module

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

 



Put a new module at the end of the list intead of making
new modules at the top of the list. find_module_all() start
the hunt using the first entry on the list, if we assume
that the modules which are first loaded are the most
frequently looked for modules this should provide a tiny
optimization.

With a 8vcpu 8 GiB RAM kvm guest with kdevops with kdevops
this saves about 4 MiB of RAM max use during the kmod tests
0008 which loops and runs loading a module in a loop through
kthreads while not affecting the time to test.

There could be some minor savings for systems that have repeated
module requests for subsystems that are not yet optimized (ACPI
frequency drivers come to mind) so in theory this could help there
but that is just pure speculation.

Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
---
 kernel/module/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/module/main.c b/kernel/module/main.c
index 0ad26455def2..32955b7819b3 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -2682,7 +2682,7 @@ static int add_unformed_module(struct module *mod)
 		goto out;
 
 	mod_update_bounds(mod);
-	list_add_rcu(&mod->list, &modules);
+	list_add_tail_rcu(&mod->list, &modules);
 	mod_tree_insert(mod);
 	err = 0;
 
-- 
2.39.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux