All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: viro@parcelfarce.linux.theplanet.co.uk
Cc: Greg KH <greg@kroah.com>, Maneesh Soni <maneesh@in.ibm.com>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] fix sysfs symlinks
Date: Sat, 17 Apr 2004 16:15:34 +1000	[thread overview]
Message-ID: <1082179555.1390.102.camel@bach> (raw)
In-Reply-To: <20040415191447.GE24997@parcelfarce.linux.theplanet.co.uk>

On Fri, 2004-04-16 at 05:14, viro@parcelfarce.linux.theplanet.co.uk
wrote:
> BTW, how about a new section that would
> 	a) be allocated separately at module load time
> 	b) contain a kobject with ->release() freeing that section
> 	c) be populated with structures containing kobjects and having
> no ->release(); main kobject would be pinned down by them.  Original
> refcount in each of those guys would be 1.
> 
> module_exit() would unregister all stuff we have in there and then drop
> the references to them.  No waiting for anything and when all references
> to these objects are gone, we get the section freed.  That can happen
> way after the completion of rmmod - as the matter of fact we could have
> the same module loaded again by that time.

Or you could skip the extra section, and keep all the module memory
until later.  Instead of a section marker, you then set the release of
those static things to "static_release" which does the put on the module
memory kref:

void static_release(struct kobject *kobj)
{
	struct module *mod;

	down(&module_mutex);
	list_for_each_entry(mod, &modules, list) {
		BUG_ON(within(kobj, mod->module_init, mod->init_size);
		if (within(kobj, mod->module_core, mod->core_size)) {
			kref_put(&mod->mem_kref);
			up(&module_mutex);
			return;
		}
	}
	up(&module_mutex);
	BUG();
}

One question which comes to mind, who does the original kref_get()s on
the module memory?  Even if we did have a separate section, the module
loader can't know how many objects objects are in there...

Cheers,
Rusty.
-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell


  parent reply	other threads:[~2004-04-17  6:15 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-13 12:40 [RFC] fix sysfs symlinks Maneesh Soni
2004-04-13 13:36 ` viro
2004-04-14  6:40   ` Maneesh Soni
2004-04-14  7:02     ` viro
2004-04-14  7:17       ` Maneesh Soni
2004-04-14  7:27         ` viro
2004-04-15  8:17       ` Russell King
2004-04-15 10:38         ` viro
2004-04-15 15:19           ` Russell King
2004-04-15 16:10             ` Greg KH
2004-04-15 16:13               ` viro
2004-04-15 19:14                 ` viro
2004-04-15 21:27                   ` Greg KH
2004-04-17  6:15                   ` Rusty Russell [this message]
2004-04-17 19:39                     ` viro
2004-04-17 23:45                       ` Rusty Russell
2004-04-15 22:02   ` Greg KH
2004-04-16 15:24     ` viro
2004-04-16 18:03       ` Horst von Brand
2004-04-16 18:07         ` viro
2004-04-16 22:37       ` Greg KH
2004-04-16 23:46         ` viro
2004-04-17  0:03           ` Jeff Garzik
2004-04-17  8:07             ` Russell King
2004-04-17  8:22               ` viro
2004-04-20 16:16                 ` Greg KH
2004-04-21 10:11                   ` Maneesh Soni
2004-04-22 21:37                     ` viro
2004-04-23  8:52                       ` Maneesh Soni
2004-04-23  9:26                         ` viro
2004-04-29 13:03                           ` Maneesh Soni
2004-04-29 15:41                             ` viro
2004-04-30 10:05                               ` Maneesh Soni
2004-04-30 10:13                                 ` [RFC 0/2] kobject_set_name - error handling Maneesh Soni
2004-04-30 10:14                                   ` [RFC 1/2] " Maneesh Soni
2004-04-30 10:17                                     ` [RFC 2/2] " Maneesh Soni
2004-05-04 13:08                                       ` Maneesh Soni
2004-04-30 12:48                                     ` [RFC 1/2] " Dmitry Torokhov
2004-05-04  5:39                                       ` Maneesh Soni
2004-05-04  9:19                                         ` Maneesh Soni
2004-05-07 22:25                                         ` Greg KH
2003-05-09 10:05                                           ` Maneesh Soni
2003-05-09 10:09                                             ` [RFC 2/2] sysfs_rename_dir-cleanup Maneesh Soni
2004-05-11 23:33                                               ` Greg KH
2004-10-07  5:16                                                 ` Maneesh Soni
2004-10-07  5:38                                                   ` Maneesh Soni
2004-05-14 19:10                                                     ` Greg KH
2004-05-11 23:32                                             ` [RFC 1/2] kobject_set_name - error handling Greg KH
2004-04-17  0:15           ` [RFC] fix sysfs symlinks Greg KH

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=1082179555.1390.102.camel@bach \
    --to=rusty@rustcorp.com.au \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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.