Re: sys_delete_module (NULL) - a bug, or a feature?

Khimenko Victor (khim@sch57.msk.ru)
Tue, 5 Jan 1999 22:52:20 +0300 (MSK)


In <19990104230027.C1507@hexagon> Nimrod Zimerman (zimerman@deskmail.com) wrote:
> 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 always work as expected.

> It requires several calls to sys_delete_module to reliably remove all
> unused modules.

It was designed this way.

> 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.

Feature. Back from 2.0 days...

> 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.

Think more about lp example, auto-unloading and lpr'ing of postscript files on
non-postscript printer :-))

-
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/