Maximum number of shared memory segments limited to 32767 in the kernel. why ?.

本文探讨了Red Hat Enterprise Linux中共享内存段数量限制为32767的原因,并提供了修改内核参数以增加共享内存段限制的方法。通过更改内核源文件include/linux/ipc.h中的IPCMNI值,可以将限制提升至45000,从而允许分配更多共享内存段。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://access.redhat.com/solutions/59416

 SOLUTION 已验证 - 已更新 2016年四月1日01:43 - 

English 

环境

  • 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:

Raw

error 28 (no space left on device)

决议

From kernel source file include/linux/ipc.h  there is a restriction for 32768.

Raw

#define IPCMNI 32768  /* <= MAX_INT limit for ipc arrays (including sysctl changes) */

诊断步骤

Build kernel with below changes:

Raw

--- 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.

Raw

>   
> # ./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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值