aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/ipc/util.c b/ipc/util.c
index c27f0e92f489..2d545d7144a7 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -33,6 +33,7 @@
33#include <linux/audit.h> 33#include <linux/audit.h>
34#include <linux/nsproxy.h> 34#include <linux/nsproxy.h>
35#include <linux/rwsem.h> 35#include <linux/rwsem.h>
36#include <linux/memory.h>
36#include <linux/ipc_namespace.h> 37#include <linux/ipc_namespace.h>
37 38
38#include <asm/unistd.h> 39#include <asm/unistd.h>
@@ -55,11 +56,41 @@ struct ipc_namespace init_ipc_ns = {
55atomic_t nr_ipc_ns = ATOMIC_INIT(1); 56atomic_t nr_ipc_ns = ATOMIC_INIT(1);
56 57
57 58
59#ifdef CONFIG_MEMORY_HOTPLUG
60
61static int ipc_memory_callback(struct notifier_block *self,
62 unsigned long action, void *arg)
63{
64 switch (action) {
65 case MEM_ONLINE: /* memory successfully brought online */
66 case MEM_OFFLINE: /* or offline: it's time to recompute msgmni */
67 /*
68 * This is done by invoking the ipcns notifier chain with the
69 * IPC_MEMCHANGED event.
70 */
71 ipcns_notify(IPCNS_MEMCHANGED);
72 break;
73 case MEM_GOING_ONLINE:
74 case MEM_GOING_OFFLINE:
75 case MEM_CANCEL_ONLINE:
76 case MEM_CANCEL_OFFLINE:
77 default:
78 break;
79 }
80
81 return NOTIFY_OK;
82}
83
84#endif /* CONFIG_MEMORY_HOTPLUG */
85
58/** 86/**
59 * ipc_init - initialise IPC subsystem 87 * ipc_init - initialise IPC subsystem
60 * 88 *
61 * The various system5 IPC resources (semaphores, messages and shared 89 * The various system5 IPC resources (semaphores, messages and shared
62 * memory) are initialised 90 * memory) are initialised
91 * A callback routine is registered into the memory hotplug notifier
92 * chain: since msgmni scales to lowmem this callback routine will be
93 * called upon successful memory add / remove to recompute msmgni.
63 */ 94 */
64 95
65static int __init ipc_init(void) 96static int __init ipc_init(void)
@@ -67,6 +98,8 @@ static int __init ipc_init(void)
67 sem_init(); 98 sem_init();
68 msg_init(); 99 msg_init();
69 shm_init(); 100 shm_init();
101 hotplug_memory_notifier(ipc_memory_callback, IPC_CALLBACK_PRI);
102 register_ipcns_notifier(&init_ipc_ns);
70 return 0; 103 return 0;
71} 104}
72__initcall(ipc_init); 105__initcall(ipc_init);