Re: [RFC] Raceless module interface

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Wed Sep 11 2002 - 20:31:21 EST


In message <E17pCKQ-0007Sz-00@starship> you write:
> Hi Roman,
>
> On Tuesday 10 September 2002 12:17, Roman Zippel wrote:
> > I implemented something like this some time ago. If module->count isn't
> > used by module.c anymore, why should it be in the module structure?
> > Consequently I removed it from the module struct (what breaks of course
> > unloading of all modules, so I'll probably reintroduce it with big a
> > warning). If the count isn't in the module structure, the locking will
> > become quite simpler. More info is here
> > http://marc.theaimsgroup.com/?l=linux-kernel&m=102754132716703&w=2
>
> Ah, I remember your original post but I didn't fully understand what you were

I hate people who can't be concise. It's a sign of sloppy thinking.

1) You only need reference counts if you want to unload a module.

2) A module can control its own reference counts safely if it does not
   sleep without holding a reference, and you use the rcu patch's
   synchronize_kernel() primitive.

3) Relying on *every* driver to control its own reference counts is a
   recipe for disaster: some subsystems will want to control module
   counts for their users.

4) Moving reference counts out of the module and into the particular
   objects is *not* a good idea, since per-cpu cache-friendly
   refcounting schemes are (almost by definition) about
   SMP_CACHE_BYTES*NR_CPUS in size.

Hope I haven't missed anything,
Rusty.

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 15 2002 - 22:00:27 EST