mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Greg KH <greg@kroah.com>
Cc: Alex Buell <alex.buell@munted.org.uk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michael Tokarev <mjt@tls.msk.ru>,
	Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Subject: Re: Unused modules in 2.6.x
Date: Sat, 28 Feb 2009 13:49:26 +0100	[thread overview]
Message-ID: <49A932D6.6070502@s5r6.in-berlin.de> (raw)
In-Reply-To: <20090225192810.GA6150@kroah.com>

Greg KH wrote:
> On Wed, Feb 25, 2009 at 05:52:49PM +0000, Alex Buell wrote:
>> Hi,
>>
>> Perhaps I missed something when the 2.6.x kernels got started a few
>> years back, but why is it not possible for unused modules to be
>> automatically unloaded anymore i.e with rmmod -a? I remember being able
>> to do that with the 2.2.x and 2.4.x series a long time ago.
> 
> Because if you do that, lots of modules that were being "used" by the
> system would get unloaded (usb host controllers, network drivers, etc.)
> 
> So it makes sense not to do that anymore.  See the linux-kernel archives
> about 6 years ago for details if you are curious about this historical
> issue (hint, it could burn you very badly even in 2.2 and 2.4...)

Alex,

the "use count" tracks how many sites in the kernel might be using
symbols in a module (call functions of a module etc.).  The "use count"
does *not* track anything higher-level than that, e.g. (as pointed out
by Lennart) "this module might soon come in handy to start accessing
some hardware" or (as pointed out by Michael) "this module provides
functionality for one of the links in a currently active IO path".

So, the meaning of Greg's "could burn you" in kernel 2.6 is basically:
Unloading of seemingly unused modules won't crash the kernel (occasional
driver bugs excepted) but it might switch off kernel functionality which
you still intended to use.

But why don't we count "this module provides functionality for one of
the links in a currently active IO path" too, generally?¹  Because for
the kernel, "user requests to unbind this driver from that device" is
merely yet another kind of a family of events like "user plugged out
that cable", "user ejected this card", "user sent a shutdown request to
that peer" etc.

------
¹)  Only in very simple cases is "is part of an IO path"
indistinguishable from "another kernel site uses symbols of this
module"; and there are very rare exceptional cases in which we do count
"is part of an IO path" explicitly for specific reasons.
-- 
Stefan Richter
-=====-==--= --=- ===--
http://arcgraph.de/sr/

      parent reply	other threads:[~2009-02-28 12:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-25 17:52 Alex Buell
2009-02-25 18:40 ` Michael Tokarev
2009-02-26 10:29   ` Alex Buell
2009-02-26 14:48     ` Lennart Sorensen
2009-02-25 19:28 ` Greg KH
2009-02-26 10:30   ` Alex Buell
2009-02-28 12:49   ` Stefan Richter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49A932D6.6070502@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=alex.buell@munted.org.uk \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsorense@csclub.uwaterloo.ca \
    --cc=mjt@tls.msk.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®