Skip to content

Commit f9b90c2

Browse files
legionusebiederm
authored andcommitted
docs: Add information about ipc sysctls limitations
After 25b21cb ("[PATCH] IPC namespace core") and 4e98231 ("[PATCH] IPC namespace - shm") the shared memory page count stopped being global and started counting per ipc namespace. The documentation and shmget(2) still says that shmall is a global option. shmget(2): SHMALL System-wide limit on the total amount of shared memory, measured in units of the system page size. On Linux, this limit can be read and modified via /proc/sys/kernel/shmall. I think the changes made in 2006 should be documented. Signed-off-by: Alexey Gladkov <legion@kernel.org> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Link: https://lkml.kernel.org/r/ede20ddf7be48b93e8084c3be2e920841ee1a641.1663756794.git.legion@kernel.org Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
1 parent 54e1011 commit f9b90c2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Documentation/admin-guide/sysctl/kernel.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,9 @@ default (``MSGMNB``).
541541
``msgmni`` is the maximum number of IPC queues. 32000 by default
542542
(``MSGMNI``).
543543

544+
All of these parameters are set per ipc namespace. The maximum number of bytes
545+
in POSIX message queues is limited by ``RLIMIT_MSGQUEUE``. This limit is
546+
respected hierarchically in the each user namespace.
544547

545548
msg_next_id, sem_next_id, and shm_next_id (System V IPC)
546549
========================================================
@@ -1181,15 +1184,20 @@ are doing anyway :)
11811184
shmall
11821185
======
11831186

1184-
This parameter sets the total amount of shared memory pages that
1185-
can be used system wide. Hence, ``shmall`` should always be at least
1186-
``ceil(shmmax/PAGE_SIZE)``.
1187+
This parameter sets the total amount of shared memory pages that can be used
1188+
inside ipc namespace. The shared memory pages counting occurs for each ipc
1189+
namespace separately and is not inherited. Hence, ``shmall`` should always be at
1190+
least ``ceil(shmmax/PAGE_SIZE)``.
11871191

11881192
If you are not sure what the default ``PAGE_SIZE`` is on your Linux
11891193
system, you can run the following command::
11901194

11911195
# getconf PAGE_SIZE
11921196

1197+
To reduce or disable the ability to allocate shared memory, you must create a
1198+
new ipc namespace, set this parameter to the required value and prohibit the
1199+
creation of a new ipc namespace in the current user namespace or cgroups can
1200+
be used.
11931201

11941202
shmmax
11951203
======

0 commit comments

Comments
 (0)