[PATCH] kernel/module.c Getting rid of the redundant spinlock in resolve_symbol()

From: Ashutosh Naik
Date: Thu Dec 15 2005 - 22:30:40 EST


On 12/15/05, Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:
> On Wed, 2005-12-14 at 11:16 +0530, Ashutosh Naik wrote:
> > On 12/14/05, Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:
> > Was just wondering, in that case, if we really need the spinlock in
> > resolve_symbol() function, where there exists a spinlock around the
> > __find_symbol() function
>
> Yes, I think that's redundant as well. We're not altering the module
> list itself, so either of the two locks is sufficient, and we have the
> semaphore.

Changelog -

This patch gets rid of the redundant spinlock in the function
resolve_symbol() as we are not altering the module list, and we
already hold the semaphore.

Signed-off-by: Ashutosh Naik <ashutosh.naik@xxxxxxxxx>
diff -Naurp linux-2.6.15-rc5-vanilla/kernel/module.c linux-2.6.15-rc5/kernel/module.c
--- linux-2.6.15-rc5-vanilla/kernel/module.c 2005-12-14 10:14:08.000000000 +0530
+++ linux-2.6.15-rc5/kernel/module.c 2005-12-15 09:41:59.000000000 +0530
@@ -958,7 +958,6 @@ static unsigned long resolve_symbol(Elf_
unsigned long ret;
const unsigned long *crc;

- spin_lock_irq(&modlist_lock);
ret = __find_symbol(name, &owner, &crc, mod->license_gplok);
if (ret) {
/* use_module can fail due to OOM, or module unloading */
@@ -966,7 +965,6 @@ static unsigned long resolve_symbol(Elf_
!use_module(mod, owner))
ret = 0;
}
- spin_unlock_irq(&modlist_lock);
return ret;
}