aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ipc_namespace.h
diff options
context:
space:
mode:
authorNadia Derbey <Nadia.Derbey@bull.net>2008-04-29 04:00:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:12 -0400
commitb6b337ad1c1d6fe11b09b35d75464b84b3e11f07 (patch)
treedf174a23a827cc43db76900d1ddbbef3ac9ddc90 /include/linux/ipc_namespace.h
parent0c40ba4fd64f98e7a5cba8ffaedbd68642a85700 (diff)
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 <Nadia.Derbey@bull.net> Cc: Yasunori Goto <y-goto@jp.fujitsu.com> Cc: Matt Helsley <matthltc@us.ibm.com> Cc: Mingming Cao <cmm@us.ibm.com> Cc: Pierre Peiffer <pierre.peiffer@bull.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/ipc_namespace.h')
-rw-r--r--include/linux/ipc_namespace.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 878d7ac286fa..cfb2a08b28f5 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -4,6 +4,17 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/idr.h> 5#include <linux/idr.h>
6#include <linux/rwsem.h> 6#include <linux/rwsem.h>
7#ifdef CONFIG_MEMORY_HOTPLUG
8#include <linux/notifier.h>
9#endif /* CONFIG_MEMORY_HOTPLUG */
10
11/*
12 * ipc namespace events
13 */
14#define IPCNS_MEMCHANGED 0x00000001 /* Notify lowmem size changed */
15
16#define IPCNS_CALLBACK_PRI 0
17
7 18
8struct ipc_ids { 19struct ipc_ids {
9 int in_use; 20 int in_use;
@@ -30,6 +41,10 @@ struct ipc_namespace {
30 size_t shm_ctlall; 41 size_t shm_ctlall;
31 int shm_ctlmni; 42 int shm_ctlmni;
32 int shm_tot; 43 int shm_tot;
44
45#ifdef CONFIG_MEMORY_HOTPLUG
46 struct notifier_block ipcns_nb;
47#endif
33}; 48};
34 49
35extern struct ipc_namespace init_ipc_ns; 50extern struct ipc_namespace init_ipc_ns;
@@ -37,9 +52,33 @@ extern atomic_t nr_ipc_ns;
37 52
38#ifdef CONFIG_SYSVIPC 53#ifdef CONFIG_SYSVIPC
39#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 54#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
40#else 55
56#ifdef CONFIG_MEMORY_HOTPLUG
57
58extern int register_ipcns_notifier(struct ipc_namespace *);
59extern int unregister_ipcns_notifier(struct ipc_namespace *);
60extern int ipcns_notify(unsigned long);
61
62#else /* CONFIG_MEMORY_HOTPLUG */
63
64static inline int register_ipcns_notifier(struct ipc_namespace *ipcns)
65{
66 return 0;
67}
68static inline int unregister_ipcns_notifier(struct ipc_namespace *ipcns)
69{
70 return 0;
71}
72static inline int ipcns_notify(unsigned long ev)
73{
74 return 0;
75}
76
77#endif /* CONFIG_MEMORY_HOTPLUG */
78
79#else /* CONFIG_SYSVIPC */
41#define INIT_IPC_NS(ns) 80#define INIT_IPC_NS(ns)
42#endif 81#endif /* CONFIG_SYSVIPC */
43 82
44#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS) 83#if defined(CONFIG_SYSVIPC) && defined(CONFIG_IPC_NS)
45extern void free_ipc_ns(struct kref *kref); 84extern void free_ipc_ns(struct kref *kref);