All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Patrick Mochel <mochel@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] add kobject to struct module
Date: Wed, 10 Sep 2003 23:26:49 -0700	[thread overview]
Message-ID: <20030911062649.GA10454@kroah.com> (raw)
In-Reply-To: <20030911011644.DA21C2C335@lists.samba.org>

On Thu, Sep 11, 2003 at 11:13:25AM +1000, Rusty Russell wrote:
> > > > But in looking at your patch, I don't see why you want to separate the
> > > > module from the kobject?  What benefit does it have?
> > > 
> > > The lifetimes are separate, each controlled by their own reference
> > > count.  I *know* this will work even if someone holds a reference to
> > > the kobject (for some reason in the future) even as the module is
> > > removed.
> > 
> > Correct me if I'm wrong, but this sounds similar to the networking 
> > refcount problem. The reference on the containing object is the 
> > interesting one, as far as visibility goes. As long as its positive, the 
> > module is active. 
> 
> There are basically two choices: ensure that the reference count is
> taken using try_module_get() (kobject doesn't have an owner field, so
> it does not match this one), or ensure that an object isn't ever
> referenced after the module cleanup function is called.
> 
> In this context, that means that the module cleanup must pause until
> the reference count of the kobject hits zero, so it can be freed.
> 
> Implementation below.

Ah, nice catch on that bug.  I like this implementation.

On a site note, can't you just use a "struct completion" to use for your
waiting?  Or do you need to do something special here?

> BTW, The *real* answer IMHO is (this is 2.7 stuff:)
> 
> 1) Adopt a faster, smaller implementation of alloc_percpu (this patch
>    exists, needs some arch-dependent love for ia64).
> 2) Use it to generalize the current module reference count scheme to
>    a "bigref_t" (I have a couple of these)
> 3) Use that in kobjects.

Hm, I don't know if kobjects really need to get that heavy.

> 4) Decide that module removal is not as important as it was, and not
>    all modules need be removable (at least in finite time).
> 5) Use the kobject reference count everywhere, including modules.
> 
> This would make everything faster, except for the case where someone
> is actually waiting for a refcount to hit zero: for long-lived objects
> like kobjects, this seems the right tradeoff.

As more people use kobjects, I think we'll see some pretty short
lifespans...

But yes, that's all 2.7 dreams :)

thanks,

greg k-h

  reply	other threads:[~2003-09-11  6:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-09 22:24 [RFC] add kobject to struct module Greg KH
2003-09-10  0:13 ` Greg KH
2003-09-10  3:31 ` Rusty Russell
2003-09-10  4:11   ` Greg KH
2003-09-10  8:07     ` Rusty Russell
2003-09-10 15:26       ` Patrick Mochel
2003-09-11  1:13         ` Rusty Russell
2003-09-11  6:26           ` Greg KH [this message]
2003-09-11  8:18             ` Rusty Russell
2003-09-11 17:15               ` Greg KH
2004-02-24 23:29           ` Greg KH
2004-03-05 14:34             ` Rusty Russell
2004-05-07 21:28               ` Greg KH
2003-09-10 23:06       ` Greg KH
2003-09-11  2:33         ` Rusty Russell
2003-09-10 23:32 ` Russell King
2003-09-10 23:45   ` Greg KH
2003-09-11  0:04     ` Mike Fedyk
2003-09-11  0:21       ` Greg KH
2003-09-11  2:10       ` Rusty Russell
2003-09-11  2:04   ` Rusty Russell

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=20030911062649.GA10454@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    --cc=rusty@rustcorp.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.