https://access.redhat.com/solutions/59416
SOLUTION 已验证 - 已更新 2016年四月1日01:43 -
环境
- Red Hat Enterprise Linux 4, 5, 6, and 7
问题
- Maximum number of shared memory segments limited to 32767 in the kernel. why ?
- Increase /proc/sys/kernel/shmmni to more than 32768
- When the number of segments reaches 32767 shmget gives:
error 28 (no space left on device)
决议
From kernel source file include/linux/ipc.h there is a restriction for 32768.
#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
诊断步骤
Build kernel with below changes:
--- linux-2.6.18/include/linux/ipc.h 2006-09-20 09:12:06.000000000 +0530
+++ linux-2.6.18/include/linux/rruban-ipc.h 2011-07-12 12:53:58.000000000 +0530
@@ -51,7 +51,7 @@ struct ipc_perm
#ifdef __KERNEL__
-#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
+#define IPCMNI 45000 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
/* used by in-kernel data structures */
struct kern_ipc_perm
By changing it to 45000, you areable to allocate more than 32768 shared memory segments.
>
> # ./shmtest
> Allocating segment nshmget: Success
> Allocating segment no 43000
There is a limitation of 32768 currently with all versions of RHEL and upstream Linux.
相关的参考文章:https://blog.youkuaiyun.com/msdnchina/article/details/80641613