Re: [RFC PATCH 0/6] module, kbuild: Faster boot with custom kernel.

From: Rusty Russell
Date: Thu Feb 19 2009 - 06:15:30 EST


On Thursday 19 February 2009 00:27:58 Kay Sievers wrote:
> some modules wait for 200-500 milliseconds to
> get the lock released, some larger modules spend 50 milliseconds in
> load_module(), many of them around 20 milliseconds.

OK, this is an untested hack (don't try unloading modules, not sure symbol
resolution isn't racy now I've killed the lock). Does it change the numbers?

Thanks!
Rusty.

diff --git a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2020,10 +2020,13 @@ static noinline struct module *load_modu
}
#endif
if (pcpuindex) {
+ mutex_lock(&module_mutex);
+
/* We have a special allocation for this section. */
percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size,
sechdrs[pcpuindex].sh_addralign,
mod->name);
+ mutex_unlock(&module_mutex);
if (!percpu) {
err = -ENOMEM;
goto free_percpu;
@@ -2317,19 +2320,10 @@ SYSCALL_DEFINE3(init_module, void __user
if (!capable(CAP_SYS_MODULE))
return -EPERM;

- /* Only one module load at a time, please */
- if (mutex_lock_interruptible(&module_mutex) != 0)
- return -EINTR;
-
/* Do all the hard work */
mod = load_module(umod, len, uargs);
- if (IS_ERR(mod)) {
- mutex_unlock(&module_mutex);
+ if (IS_ERR(mod))
return PTR_ERR(mod);
- }
-
- /* Drop lock so they can recurse */
- mutex_unlock(&module_mutex);

blocking_notifier_call_chain(&module_notify_list,
MODULE_STATE_COMING, mod);



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/