From: Rusty Russell <rusty@rustcorp.com.au>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC as402] Delaying module memory release
Date: Wed, 27 Oct 2004 12:40:11 +1000 [thread overview]
Message-ID: <1098844811.22012.29.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0410261520170.690-100000@ida.rowland.org>
On Tue, 2004-10-26 at 15:52 -0400, Alan Stern wrote:
> This issue has come up in the past, without much in the way of visible
> results.
>
> The problem is that sometimes the memory for a kernel module needs to be
> freed _after_ rmmod has exited. The classic example is where the standard
> input to the rmmod process has been redirected to a pseudo-file that pins
> a kobject whose release method calls into the module. Another example
> (which could be worked around with some effort) is multiple kernel threads
> executing in the module -- the module exit routine would have to wait for
> each one of them to terminate.
>
> In these cases it's not desirable/feasible to increment the module's
> refcount.
Why not? In the former the module is still in use, in the latter the
module_exit routine is expected to clean up.
> Instead the module's exit routine should run and rmmod should
> return, but the module's memory should only be freed when it is known that
> nothing else will try to use it.
[Snip poor man's two-stage module delete patch].
We've been here lots of times before. Most people want "remove or fail"
semantics for module removal. Two-stage delete doesn't do this, but
instead leaves modules in a "half-removed" state, where the module
cannot be used, but usually a replacement module cannot be loaded
either. This is what "rmmod --wait" does: close off module use to
future users (ie. try_module_get() will fail) and wait for the refcnt to
hit 0.
This option has not proven popular.
Rusty.
--
next prev parent reply other threads:[~2004-10-27 2:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-26 19:52 [RFC as402] Delaying module memory release Alan Stern
2004-10-27 2:40 ` Rusty Russell [this message]
2004-10-27 15:04 ` Alan Stern
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=1098844811.22012.29.camel@localhost.localdomain \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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