I tried

ipcs -lm

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 34359738368
min seg size (bytes) = 1


cat /proc/sys/kernel/shmmni
cat /proc/sys/kernel/shmmax
cat /proc/sys/kernel/shmall

From the documentation I've read I understood they're describing the same values yet they're different. Can you please explain me what's the difference between them?


  • I answer too quickly, I got same value for shmmax on ubuntu (not in Suse), but "wrong" value for shmall (in both ubuntu and suse). (which are in 2^64 range).
    – Archemar
    Jul 25, 2019 at 11:34

1 Answer 1


On Linux, ipcs does read shared memory limits from /proc. Only if that fails does it fall back to using shmctl(). And there is a # define SHMMIN 1 as apparently that isn't in /proc.

  • /proc/sys/kernel/shmall units are pages, ipcs converts max total shared memory to KB.
  • /proc/sys/kernel/shmmax units are bytes, ipcs converts max seg size to KB.

The source code is the util-linux package, one mirror of which is at https://github.com/karelzak/util-linux/blob/stable/v2.33/sys-utils/ipcs.c
Notice that do_shm() does a page size unit conversion:

uint64_t tmp, pgsz = getpagesize();

tmp = (uint64_t) lim.shmall * pgsz;

(Because max total shared memory / shmall = page size, can tell your machine has 4 KB pages. Expected, that is extremely common.)

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.