Re: RE2: [OKS] Module removal

From: Russ Lewis (spamhole-2001-07-16@deming-os.org)
Date: Tue Jul 09 2002 - 14:23:31 EST


Keith Owens wrote:

> All functions passed to registration routines by modules are uncounted
> references. A module is loaded, registers its operations and exits
> from the cleanup routine. At that point its use count is 0, even
> though it there are references to the module from tables outside the
> module.

Perhaps we should have 2 counters: a use count and a reference count. You can

start the unload process at any time that the use count is 0, but you can't
unload the module's memory until the reference count is 0. This is the
2-stage unload, formalized with counters for each stage.

You could register references from outside the module. AFAIK, you can take
any pointer or function pointer and do a lookup to find out what module it
belongs to. Thus, when you pass pointers (in a registration) to another
module, then it calls some function (register_reference, say) on each pointer
and function pointer. When it can guarantee that it is about to discard a
pointer (and so it will never use it again), then it calls
unregister_reference.

You may not have to register each pointer in an ops structure...it might be
enough to just call register_reference on the ops structure itself, since that

would hold the module in place. Doesn't work if the ops structure is
dynamically allocated memory, but then register_reference would be able to
return a failure return code "NOT_MODULE_MEMORY" or some such.

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]

- 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 : Mon Jul 15 2002 - 22:00:16 EST