I'm just wondering where these values are being set and what they default to? Mine is currently 18446744073692774399. I didn't set it anywhere that I can see.

$ cat /proc/sys/kernel/shmmax 

$ sysctl kernel.shmmax
kernel.shmmax = 18446744073692774399

2 Answers 2


The __init function ipc_ns_init sets the initial value of shmmax by calling shm_init_ns, which sets it to the value of the SHMMAX macro.

The definition of SHMMAX is in <uapi/linux/shm.h>:

#define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */

On 64-bit machines, that definition equals the value you found, 18446744073692774399.


On the fly you can just echo into /proc/sys/kernel/shmmax!

# echo 20446744073692774399 > /proc/sys/kernel/shmmax

But most people edit /etc/sysctl.conf with a line similar to:


See the sysctl(8) man page.

  • That's not the question. Where are the defaults set? That is, if you don't write to shmmax yourself, what does it default to? Jun 14, 2017 at 2:09
  • 2
    On some Linux distros (RHEL 5&6 I believe is one) it is set in /etc/sysctl.conf. But I think the default is set in the kernel code to the theoretical limit (guessing that's 2^64 - 1?).
    – Deathgrip
    Jun 14, 2017 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.