环境
-
Red Hat Enterprise Linux 7.8
- starting with kernel version 3.10.0-1127.el7.x86_64
-
Red Hat Enterprise Linux 8.1
- starting with kernel version 4.18.0-147.el8_1.x86_64
问题
- On RHEL 7.8 and 8.1 servers, setting the value of semaphore parameter
SEMMNI
beyond32768
fails with the error messagesysctl: setting key "kernel.sem": Numerical result out of range
.
# sysctl -w kernel.sem="4096 2048000 32 32769"
sysctl: setting key "kernel.sem": Numerical result out of range
kernel.sem = 4096 2048000 32 32769
- Anything up to and including 32768 succeeds :
# sysctl -w kernel.sem="4096 2048000 32 32768"
kernel.sem = 4096 2048000 32 32768
- This also applies to
kernel.msgmni
andkernel.shmmni
决议
-
The change in
SEMMNI
behaviour is a recent change and expected behaviour that has been backported to the RHEL kernel. -
Now, the maximum limit of
SEMMNI
has been set to32768
. -
It is still possible to go beyond this limit by booting the server with the kernel command line parameter
ipcmni_extend
.
For RHEL 7
:
-
Add this parameter
ipcmni_extend
in kernel commandline and reboot for changes to get reflected. -
Below are the steps:
-
At the end of "GRUB_CMDLINE_LINUX" in "/etc/default/grub" and then save and exit the file.
# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap console=tty0 console=ttyS0,115200 ipcmni_extend"<--
GRUB_DISABLE_RECOVERY="true"
- Rebuild the grub.
for BIOS:
# grub2-mkconfig -o /boot/grub2/grub.cfg
for UEFI:
# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
-
Reboot the system for changes to get reflected.
-
Once the changes are done, it will be possible to set the value to greater than 32768.
# sysctl -w kernel.sem="4096 2048000 32 32769"
kernel.sem = 4096 2048000 32 32769
For RHEL 8
:
- Use
grub2-editenv
to edit the grub :
# grub2-editenv - set "kernelopts=root=UUID=XXXX [........] ipcmni_extend"
-
Reboot the server for changes to get reflected.
-
Note: There is no need to rebuild the grub on
RHEL 8
.
根源
-
The upstream commits that introduced the change are 6730e658017 and 8c81ddd2acd.
-
These commits have been backported to RHEL in commits
5523711052c
ande3ea54f485a
. -
The commit states :
ipc: IPCMNI limit check for msgmni and shmmni
Patch series "ipc: IPCMNI limit check for *mni & increase that limit", v9.
The sysctl parameters msgmni, shmmni and semmni have an inherent limit of
IPC_MNI (32k). However, users may not be aware of that because they can
write a value much higher than that without getting any error or
notification. Reading the parameters back will show the newly written
values which are not real.
The real IPCMNI limit is now enforced to make sure that users won't put in
an unrealistic value. The first 2 patches enforce the limits.
There are also users out there requesting increase in the IPCMNI value.
The last 2 patches attempt to do that by using a boot kernel parameter
"ipcmni_extend" to increase the IPCMNI limit from 32k to 8M if the users
really want the extended value.
Additional Notes :
- When a server with RHEL-8.0 / RHEL-7.7 or below kernel having the configured value of
SHMMNI
greater than 32768 will be updated
to RHEL-8.1 / RHEL-7.8 kernel, then the value ofSHMMNI
will fall back to default 4096. - Similarly when a server with RHEL-8.0 / RHEL-7.7 or below kernel having the configured value of
MSGMNI
greater than 32768 will be updated
to RHEL-8.1 / RHEL-7.8 kernel, then the value ofMSGMNI
will fall back to default 32000. - Likewise when a server with RHEL-8.0 / RHEL-7.7 or below kernel having the configured value of
SEMMNI
greater than 32768 will be updated
to RHEL-8.1 / RHEL-7.8 kernel, then the value ofSEMMNI
will fall back to default 128.
诊断步骤
- Update the RHEL 7 kernel to the
3.10.0-1127.el7.x86_64
or RHEL 8 kernel to4.18.0-147.el8_1.x86_64
. Then set the parameter value as shown below which will fail :
# sysctl -w kernel.sem="4096 2048000 32 32769"
sysctl: setting key "kernel.sem": Numerical result out of range
kernel.sem = 4096 2048000 32 32769
- Anything up to and including 32768 will succeed :
# sysctl -w kernel.sem="4096 2048000 32 32768"
kernel.sem = 4096 2048000 32 32768
- Boot the server with the kernel command line parameter
ipcmni_extend
and again set the value to 32769 which will succeed :
# sysctl -w kernel.sem="4096 2048000 32 32769"
kernel.sem = 4096 2048000 32 32769