summaryrefslogtreecommitdiffstats
path: root/init/initramfs.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2014-11-10 09:30:29 +1030
committerRusty Russell <rusty@rustcorp.com.au>2014-11-11 17:07:46 +1030
commite513cc1c07e2ab93a4514eec9833e031df3e30bb (patch)
tree77f3db46fd317bb4074adee61ec4beb2a43a79cc /init/initramfs.c
parent2f35c41f58a978dfa44ffa102249d556caa99eeb (diff)
downloadlinux-e513cc1c07e2ab93a4514eec9833e031df3e30bb.tar.gz
linux-e513cc1c07e2ab93a4514eec9833e031df3e30bb.tar.bz2
linux-e513cc1c07e2ab93a4514eec9833e031df3e30bb.zip
module: Remove stop_machine from module unloading
Remove stop_machine from module unloading by adding new reference counting algorithm. This atomic refcounter works like a semaphore, it can get (be incremented) only when the counter is not 0. When loading a module, kmodule subsystem sets the counter MODULE_REF_BASE (= 1). And when unloading the module, it subtracts MODULE_REF_BASE from the counter. If no one refers the module, the refcounter becomes 0 and we can remove the module safely. If someone referes it, we try to recover the counter by adding MODULE_REF_BASE unless the counter becomes 0, because the referrer can put the module right before recovering. If the recovering is failed, we can get the 0 refcount and it never be incremented again, it can be removed safely too. Note that __module_get() forcibly gets the module refcounter, users should use try_module_get() instead of that. Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'init/initramfs.c')
0 files changed, 0 insertions, 0 deletions