Re: [RFC] Raceless module interface

Daniel Phillips (phillips@arcor.de)
Mon, 16 Sep 2002 23:48:41 +0200


On Monday 16 September 2002 23:36, Roman Zippel wrote:
> > > > I disagree with pushing the count into the filesystem structure: it
> > > > changes nothing except hide the fact that you're only keeping
> > > > reference counts for the sake of the module. Filesystems are low
> > > > performance impact, but other subsystems really don't want that atomic
> > > > inc and dec for every access.
> > >
> > > As I already said before, it doesn't has to be an atomic reference count.
> >
> > Please explain? It has to be atomic for all the interesting cases
> > (sure, fs mounting might be protected by a lock, but other things aren't).
>
> Let me explain it in a larger context. You and Daniel are making it really
> more complex than necessary. Only the module itself can really answer the
> question whether it's safe to unload or not.

Excuse me, Roman, but that's the central thesis of my [rfc]. If I didn't
express it concisely enough to make that obvious, I apologize.

> So all the module code
> needs to do is some general module management and ask the module somehow,
> whether it's safe to unload, when the user requests it. The easiest way
> for modules to check for this is to use counters, it's very simple and
> covers the majority of modules.

Err, check. In the [rfc].

> The few modules that don't want/can't use counters can use whatever they
> want and they usually know better how to synchronize with the part of the
> kernel where they installed their hooks into, without disturbing too much
> other parts of the kernel.

Check. In the [rfc].

> I really don't like the synchronize calls as general mechanism, either
> they have to to do too much and possibly disturb other parts without good
> reason

Check. In the [rfc].

> or modules have to take care of it (e.g. don't call somehow
> schedule() without extra protection). This makes the whole synchronize
> mechanism very fragile, which I'd prefer to keep it in the modules which
> really need it, where it can be better controlled.

Yuppers. Are there any points at all we disagree on?

-- 
Daniel
-
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/