4

I am having an amiguity as to what the maximum value in shmmax should be set.

After having a look at my system's statistics, it shows the following:

#cat /proc/sys/kernel/shmmax 
18446744073692774399

#ipcs -l

------ Messages Limits --------
max queues system wide = 3675
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384

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

------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

Ideally the value of shared memory should not exceed the actual RAM size (Which comes to be 21474836480 bytes). Then is this thing possible? Or is this a garbage value.

Parth Pathak
  • 41
  • 1
  • 2
  • Why do you even care about those values? Most systems are never going to hit those limits anyway. – kasperd Jul 01 '17 at 22:41
  • Was looking for the values and came across these. Hence, was curious as to why those are more the actual RAM? Now, since I got the confirmation that those are garbage values it's OK with me. – Parth Pathak Aug 02 '17 at 13:18

3 Answers3

2

The value you show: 18446744073692774399

corresponds to: 0xFFFFFFFFFEFFFFFF

or 1111 1111 1111 1111 1111 1111 1111 1111 63 47 1111 1110 1111 1111 1111 1111 1111 1111 31 15

so it is not exactly the maximum value of 64 bit unsigned integer, but almost.

laurent
  • 66
  • 4
  • : #define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */ https://unix.stackexchange.com/a/370996/256115 – Luke Mlsna Sep 25 '19 at 12:43
2

The default is set at the maximum possible unsigned long on a 64 bit system (2^64) = 18446744073709551616 (minus some essential memory space I'm guessing).

If the maximum shared RAM value is > the actual RAM, that just means all the available RAM can be shared. You can always lower it, but by default it is (close to) everything.

They bit shift 1 unsigned long by 24 (1UL << 24) = 16777216, then subtract that from the theoretical maximum which gives you the value.

18446744073709551616 - 16777217 = 18446744073692774399

Luke Mlsna
  • 123
  • 4
0

I'm googling for your question and found only documentation how to configure shmmax and shmall parameters. Best one was in this answer. So for your question, if your shmmax set to higher value, more then you have RAM, it's garbage value, system don't allow to use for shared memory more then you have RAM (don't know about swap).

Alexander Tolkachev
  • 4,513
  • 3
  • 14
  • 23