lkml.org 
[lkml]   [2002]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: RE2: [OKS] Module removal
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/

\
 
 \ /
  Last update: 2005-03-22 13:27    [W:0.033 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site