mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
ipc: recompute msgmni on memory add / remove
Introduce the registration of a callback routine that recomputes msg_ctlmni upon memory add / remove. A single notifier block is registered in the hotplug memory chain for all the ipc namespaces. Since the ipc namespaces are not linked together, they have their own notification chain: one notifier_block is defined per ipc namespace. Each time an ipc namespace is created (removed) it registers (unregisters) its notifier block in (from) the ipcns chain. The callback routine registered in the memory chain invokes the ipcns notifier chain with the IPCNS_LOWMEM event. Each callback routine registered in the ipcns namespace, in turn, recomputes msgmni for the owning namespace. Signed-off-by: Nadia Derbey <[email protected]> Cc: Yasunori Goto <[email protected]> Cc: Matt Helsley <[email protected]> Cc: Mingming Cao <[email protected]> Cc: Pierre Peiffer <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
0c40ba4fd6
commit
b6b337ad1c
8 changed files with 162 additions and 4 deletions
|
|
@ -26,6 +26,8 @@ static struct ipc_namespace *clone_ipc_ns(struct ipc_namespace *old_ns)
|
|||
msg_init_ns(ns);
|
||||
shm_init_ns(ns);
|
||||
|
||||
register_ipcns_notifier(ns);
|
||||
|
||||
kref_init(&ns->kref);
|
||||
return ns;
|
||||
}
|
||||
|
|
@ -81,6 +83,15 @@ void free_ipc_ns(struct kref *kref)
|
|||
struct ipc_namespace *ns;
|
||||
|
||||
ns = container_of(kref, struct ipc_namespace, kref);
|
||||
/*
|
||||
* Unregistering the hotplug notifier at the beginning guarantees
|
||||
* that the ipc namespace won't be freed while we are inside the
|
||||
* callback routine. Since the blocking_notifier_chain_XXX routines
|
||||
* hold a rw lock on the notifier list, unregister_ipcns_notifier()
|
||||
* won't take the rw lock before blocking_notifier_call_chain() has
|
||||
* released the rd lock.
|
||||
*/
|
||||
unregister_ipcns_notifier(ns);
|
||||
sem_exit_ns(ns);
|
||||
msg_exit_ns(ns);
|
||||
shm_exit_ns(ns);
|
||||
|
|
|
|||
Loading…
Reference in a new issue