tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

tmpfs module and pool allocator



Hey,

Our pool allocator code allows initializing a pool with a custom pool
allocator, passed as the argument 'palloc'. When not set, this
defaults to 'pool_allocator_kmem'. Regardless of what allocator is
used, pool_init() initializes its 'pa_lock' member, which is a mutex.

It seems that the pool(9) code never destroys this mutex, though...
(Maybe assuming it's always the 'pool_allocator_kmem' mutex?)

In the case of tmpfs as a module, where the custom allocator (and
everything else) is freed once the module is unloaded, this -- to me
at least -- results in a panic where an active mutex is being freed.
('tmpfs_pool_allocator' being global...)

I've "fixed it" by explicitly calling mutex_destroy() in
tmpfs_modcmd():MODULE_CMD_FINI, but I think the right fix would be to
set a flag indicating that the pool allocator used is not a "system
allocator" (or that it is a "custom allocator", or whatever) and
should be destroyed as well, or at least its mutex...

Anyway, is this a problem or am I missing something? :)

Thanks,

-e.


Home | Main Index | Thread Index | Old Index