Red Hat Bugzilla – Bug 1963
/etc/crontab et al has no rmmod -a invocation
Last modified: 2008-05-01 11:37:49 EDT
2.2.* kernels require 'rmmod -a' to be run periodically
in order to automatically remove autoclean(able) kernel
modules. crontabs-1.7-5 doesn't seem to have any such
invocation; presumably one should be added (at an interval
picked to suit).
I'd suggest something like:
*/10 * * * * root /sbin/rmmod -as
Periodically removing not-needed kernel modules is debatably a good
thing. However, it can be a very bad thing. For instance, for sound
cards (the most common thing to be periodically in use followed by
periods of unuse) unloading the driver causes it to lose current mixer
settings, etc. etc.
A RedHat 5.2 system will unload unused kernel modules that are
marked as autocleanable (some, eg sound modules and the st module,
are not marked autocleanable when loaded). At the moment, a
Rawhide-based system won't, because of kerneld being replaced by
other things. That's why I suspect that this is a bug.
Cristian are we going to fix this for the release.
The kmod is still in its early stages - the kmod will eventually deal
with this. For now, suddenly unloading unused modul;es can be a real
pain - for example my sound card does an ugly noise every time the
sound module is loaded, and I don;t want to hear that every N minutes.
Also, some module loading can cause real problems and delays, like
probing for a scsi card, etc.
So for now we will have to live with it.
I'm not sure this is being understood, from the comments so far,
- modules can only be removed if they are *both* unused
(for a while) *and* marked as autocleanable.
- modules loaded explicitly, such as sound and SCSI tape
and so on, are generally not marked autocleanable unless
one takes specific steps to do so.
- in 2.0.* kernels, ie in RedHat 5.0/5.1/5.2, kerneld
periodically removes such modules.
- in 2.2.* kernels there is no kerneld. In order to duplicate
its removal of idle, autocleanable modules one must run an
rmmod -a periodically. This has *identical* behavior as
A number of modules will be marked as autocleanable in a normal
configuration: ethernet drivers, PPP and compression methods, all
the various modules associated with alternate filesystems such as
MS-DOS (or NFS), the loopback driver, etc.
Right now, a RedHat 5.0/5.1/5.2/etc machine will unload these
modules when they haven't been used for a while and are no longer
needed. A Rawhide or Starbuck machine does not; they stick around
to clutter up memory.
If your RedHat 5.x machine is working fine now, adding 'rmmod -a'
to the crontab of an equivalent Starbuck/Rawhide will just make it
behave the same. Not adding it has the primary effect of cluttering
up memory with currently extraneous modules. Adding the rmmod -a
won't remove any modules that would not have been removed under 5.2
If this *really* is what Redhat thinks is the desirable behavior,
I'm puzzled, but it's your call.
(I have already seen another person report this omission on the
Starbuck mailing list, FYI.)
I understand that we are running kerneld regardless of the kernel
version, 2.0 or 2.2, so that it will do all the module loading on
a 2.0 kernel, and will do the equivalent of rmmod -a on a 2.2
cks, can you verify that unused modules are in fact not being
unloaded on your system?
I've let my system sit for an hour and a half and autocleanable
modules haven't unloaded. Two runs of rmmod -a unloaded them all.
Kerneld is definetly not started on a 2.2 kernel, as per the
code in /etc/rc.d/rc.sysinit; it only tries to start it if there
is no /proc/sys/kernel/modprobe. (And kerneld is not running on
my Rawhide system.)
johnsonm is taking care of this
Sorry, things had changed between the installed system that I was
looking at and the current release and I didn't know it. I'll add
the rmmod -a invocation. Thanks for finding this.
modutils as of 2.1.121-11 installs an /etc/cron.d/kmod that does
all kernel module related stuff; so far, rmmod -a.