lkml.org 
[lkml]   [1999]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectsys_delete_module (NULL) - a bug, or a feature?
Hello.

I've recently noticed that calling sys_delete_module(NULL) (in
kernel/module.c), which is supposed to remove all automatically loaded
modules that aren't used, doesn't always work as expected. It requires
several calls to sys_delete_module to reliably remove all unused modules.

For example, I got the 'lp' device auto-loaded (with parport_pc and
parport). lsmod says:

Module Size Used by
parport_pc 5520 1 (autoclean)
lp 4616 0 (autoclean)
parport 6868 1 (autoclean) [parport_pc lp]

After 'rmmod -a' once, lsmod still says:

Module Size Used by
parport_pc 5520 1 (autoclean)
lp 4616 0 (autoclean)
parport 6868 1 (autoclean) [parport_pc lp]

After another 'rmmod -a', lsmod says:

Module Size Used by
parport_pc 5520 0 (autoclean)
parport 6868 0 (autoclean) [parport_pc]

And finally, after another try, lsmod happily announces that no modules are
loaded.

Is this a bug? Is this a feature? I don't know.

The reason this happens, however, is the MOD_VISITED flag. It prevents
modules from immediately being released after performing a MOD_INC_USE_COUNT
or MOD_DEC_USE_COUNT on them.
I can't say that I understand why MOD_VISITED is required, and even if this
thing is a feature, I'd love to know what is the reason for it.

Thanks.

Nimrod

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

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.027 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site