aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/namespace.c
diff options
context:
space:
mode:
authorManfred Spraul <manfred@colorfullife.com>2014-12-12 19:58:17 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 15:42:52 -0500
commit0050ee059f7fc86b1df2527aaa14ed5dc72f9973 (patch)
tree9fa11fd54259ed433d89b0a483e172b8e75d8f23 /ipc/namespace.c
parente843e7d2c88b7db107a86bd2c7145dc715c058f4 (diff)
ipc/msg: increase MSGMNI, remove scaling
SysV can be abused to allocate locked kernel memory. For most systems, a small limit doesn't make sense, see the discussion with regards to SHMMAX. Therefore: increase MSGMNI to the maximum supported. And: If we ignore the risk of locking too much memory, then an automatic scaling of MSGMNI doesn't make sense. Therefore the logic can be removed. The code preserves auto_msgmni to avoid breaking any user space applications that expect that the value exists. Notes: 1) If an administrator must limit the memory allocations, then he can set MSGMNI as necessary. Or he can disable sysv entirely (as e.g. done by Android). 2) MSGMAX and MSGMNB are intentionally not increased, as these values are used to control latency vs. throughput: If MSGMNB is large, then msgsnd() just returns and more messages can be queued before a task switch to a task that calls msgrcv() is forced. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Manfred Spraul <manfred@colorfullife.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Rafael Aquini <aquini@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/namespace.c')
-rw-r--r--ipc/namespace.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c
index b54468e48e32..1a3ffd40356e 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -45,14 +45,6 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
45 msg_init_ns(ns); 45 msg_init_ns(ns);
46 shm_init_ns(ns); 46 shm_init_ns(ns);
47 47
48 /*
49 * msgmni has already been computed for the new ipc ns.
50 * Thus, do the ipcns creation notification before registering that
51 * new ipcns in the chain.
52 */
53 ipcns_notify(IPCNS_CREATED);
54 register_ipcns_notifier(ns);
55
56 ns->user_ns = get_user_ns(user_ns); 48 ns->user_ns = get_user_ns(user_ns);
57 49
58 return ns; 50 return ns;
@@ -99,25 +91,11 @@ void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
99 91
100static void free_ipc_ns(struct ipc_namespace *ns) 92static void free_ipc_ns(struct ipc_namespace *ns)
101{ 93{
102 /*
103 * Unregistering the hotplug notifier at the beginning guarantees
104 * that the ipc namespace won't be freed while we are inside the
105 * callback routine. Since the blocking_notifier_chain_XXX routines
106 * hold a rw lock on the notifier list, unregister_ipcns_notifier()
107 * won't take the rw lock before blocking_notifier_call_chain() has
108 * released the rd lock.
109 */
110 unregister_ipcns_notifier(ns);
111 sem_exit_ns(ns); 94 sem_exit_ns(ns);
112 msg_exit_ns(ns); 95 msg_exit_ns(ns);
113 shm_exit_ns(ns); 96 shm_exit_ns(ns);
114 atomic_dec(&nr_ipc_ns); 97 atomic_dec(&nr_ipc_ns);
115 98
116 /*
117 * Do the ipcns removal notification after decrementing nr_ipc_ns in
118 * order to have a correct value when recomputing msgmni.
119 */
120 ipcns_notify(IPCNS_REMOVED);
121 put_user_ns(ns->user_ns); 99 put_user_ns(ns->user_ns);
122 proc_free_inum(ns->proc_inum); 100 proc_free_inum(ns->proc_inum);
123 kfree(ns); 101 kfree(ns);