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>
This commit is contained in:
		
					parent
					
						
							
								e843e7d2c8
							
						
					
				
			
			
				commit
				
					
						0050ee059f
					
				
			
		
					 9 changed files with 45 additions and 298 deletions
				
			
		|  | @ -7,15 +7,6 @@ | |||
| #include <linux/notifier.h> | ||||
| #include <linux/nsproxy.h> | ||||
| 
 | ||||
| /*
 | ||||
|  * ipc namespace events | ||||
|  */ | ||||
| #define IPCNS_MEMCHANGED   0x00000001   /* Notify lowmem size changed */ | ||||
| #define IPCNS_CREATED  0x00000002   /* Notify new ipc namespace created */ | ||||
| #define IPCNS_REMOVED  0x00000003   /* Notify ipc namespace removed */ | ||||
| 
 | ||||
| #define IPCNS_CALLBACK_PRI 0 | ||||
| 
 | ||||
| struct user_namespace; | ||||
| 
 | ||||
| struct ipc_ids { | ||||
|  | @ -38,7 +29,6 @@ struct ipc_namespace { | |||
| 	unsigned int	msg_ctlmni; | ||||
| 	atomic_t	msg_bytes; | ||||
| 	atomic_t	msg_hdrs; | ||||
| 	int		auto_msgmni; | ||||
| 
 | ||||
| 	size_t		shm_ctlmax; | ||||
| 	size_t		shm_ctlall; | ||||
|  | @ -77,18 +67,8 @@ extern atomic_t nr_ipc_ns; | |||
| extern spinlock_t mq_lock; | ||||
| 
 | ||||
| #ifdef CONFIG_SYSVIPC | ||||
| extern int register_ipcns_notifier(struct ipc_namespace *); | ||||
| extern int cond_register_ipcns_notifier(struct ipc_namespace *); | ||||
| extern void unregister_ipcns_notifier(struct ipc_namespace *); | ||||
| extern int ipcns_notify(unsigned long); | ||||
| extern void shm_destroy_orphaned(struct ipc_namespace *ns); | ||||
| #else /* CONFIG_SYSVIPC */ | ||||
| static inline int register_ipcns_notifier(struct ipc_namespace *ns) | ||||
| { return 0; } | ||||
| static inline int cond_register_ipcns_notifier(struct ipc_namespace *ns) | ||||
| { return 0; } | ||||
| static inline void unregister_ipcns_notifier(struct ipc_namespace *ns) { } | ||||
| static inline int ipcns_notify(unsigned long l) { return 0; } | ||||
| static inline void shm_destroy_orphaned(struct ipc_namespace *ns) {} | ||||
| #endif /* CONFIG_SYSVIPC */ | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Manfred Spraul
				Manfred Spraul