Skip to content

Commit 8fd9094

Browse files
committed
Doc: update our docs about kernel IPC parameters on *BSD.
runtime.sgml said that you couldn't change SysV IPC parameters on OpenBSD except by rebuilding the kernel. That's definitely wrong in OpenBSD 6.x, and excavation in their man pages says it changed in OpenBSD 3.3. Update NetBSD and OpenBSD sections to recommend adjustment of the SEMMNI and SEMMNS settings, which are painfully small by default on those platforms. (The discussion thread contemplated recommending that people select POSIX semaphores instead, but the performance consequences of that aren't really clear, so I'll refrain.) Remove pointless discussion of SEMMNU and SEMMAP from the FreeBSD section. Minor other wordsmithing. Discussion: https://postgr.es/m/27582.1546928073@sss.pgh.pa.us
1 parent eef6476 commit 8fd9094

File tree

1 file changed

+43
-19
lines changed

1 file changed

+43
-19
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,8 @@ psql: could not connect to server: No such file or directory
733733
<para>
734734
In some cases it might also be necessary to increase
735735
<varname>SEMMAP</> to be at least on the order of
736-
<varname>SEMMNS</>. This parameter defines the size of the semaphore
736+
<varname>SEMMNS</>. If the system has this parameter
737+
(many do not), it defines the size of the semaphore
737738
resource map, in which each contiguous block of available semaphores
738739
needs an entry. When a semaphore set is freed it is either added to
739740
an existing entry that is adjacent to the freed block or it is
@@ -786,7 +787,7 @@ psql: could not connect to server: No such file or directory
786787
</term>
787788
<listitem>
788789
<para>
789-
The default settings can be changed using
790+
The default IPC settings can be changed using
790791
the <command>sysctl</command> or
791792
<command>loader</command> interfaces. The following
792793
parameters can be set using <command>sysctl</command>:
@@ -805,13 +806,9 @@ psql: could not connect to server: No such file or directory
805806
<programlisting>
806807
kern.ipc.semmni=256
807808
kern.ipc.semmns=512
808-
kern.ipc.semmnu=256
809809
</programlisting>
810-
After modifying these values a reboot is required for the new
810+
After modifying that file, a reboot is required for the new
811811
settings to take effect.
812-
(Note: FreeBSD does not use <varname>SEMMAP</>. Older versions
813-
would accept but ignore a setting for <literal>kern.ipc.semmap</>;
814-
newer versions reject it altogether.)
815812
</para>
816813

817814
<para>
@@ -835,7 +832,7 @@ kern.ipc.semmnu=256
835832

836833
<para>
837834
<systemitem class="osname">FreeBSD</> versions before 4.0 work like
838-
<systemitem class="osname">OpenBSD</> (see below).
835+
old <systemitem class="osname">OpenBSD</> (see below).
839836
</para>
840837
</listitem>
841838
</varlistentry>
@@ -850,12 +847,19 @@ kern.ipc.semmnu=256
850847
IPC parameters can be adjusted using <command>sysctl</command>,
851848
for example:
852849
<screen>
853-
<prompt>$</prompt> <userinput>sysctl -w kern.ipc.shmmax=16777216</userinput>
850+
<prompt>#</prompt> <userinput>sysctl -w kern.ipc.semmni=100</userinput>
854851
</screen>
855-
To have these settings persist over reboots, modify
852+
To make these settings persist over reboots, modify
856853
<filename>/etc/sysctl.conf</filename>.
857854
</para>
858855

856+
<para>
857+
You will usually want to increase <literal>kern.ipc.semmni</literal>
858+
and <literal>kern.ipc.semmns</literal>,
859+
as <systemitem class="osname">NetBSD</systemitem>'s default settings
860+
for these are uncomfortably small.
861+
</para>
862+
859863
<para>
860864
You might also want to configure your kernel to lock shared
861865
memory into RAM and prevent it from being paged out to swap.
@@ -864,10 +868,10 @@ kern.ipc.semmnu=256
864868
</para>
865869

866870
<para>
867-
<systemitem class="osname">NetBSD</> versions before 5.0 work like
868-
<systemitem class="osname">OpenBSD</> (see below), except that
869-
parameters should be set with the keyword <literal>options</> not
870-
<literal>option</>.
871+
<systemitem class="osname">NetBSD</systemitem> versions before 5.0
872+
work like old <systemitem class="osname">OpenBSD</systemitem>
873+
(see below), except that kernel parameters should be set with the
874+
keyword <literal>options</literal> not <literal>option</literal>.
871875
</para>
872876
</listitem>
873877
</varlistentry>
@@ -878,11 +882,31 @@ kern.ipc.semmnu=256
878882
</term>
879883
<listitem>
880884
<para>
881-
The options <varname>SYSVSHM</> and <varname>SYSVSEM</> need
882-
to be enabled when the kernel is compiled. (They are by
883-
default.) The maximum size of shared memory is determined by
884-
the option <varname>SHMMAXPGS</> (in pages). The following
885-
shows an example of how to set the various parameters:
885+
In <systemitem class="osname">OpenBSD</systemitem> 3.3 and later,
886+
IPC parameters can be adjusted using <command>sysctl</command>,
887+
for example:
888+
<screen>
889+
<prompt>#</prompt> <userinput>sysctl kern.seminfo.semmni=100</userinput>
890+
</screen>
891+
To make these settings persist over reboots, modify
892+
<filename>/etc/sysctl.conf</filename>.
893+
</para>
894+
895+
<para>
896+
You will usually want to
897+
increase <literal>kern.seminfo.semmni</literal>
898+
and <literal>kern.seminfo.semmns</literal>,
899+
as <systemitem class="osname">OpenBSD</systemitem>'s default settings
900+
for these are uncomfortably small.
901+
</para>
902+
903+
<para>
904+
In older <systemitem class="osname">OpenBSD</systemitem> versions,
905+
you will need to build a custom kernel to change the IPC parameters.
906+
Make sure that the options <varname>SYSVSHM</varname>
907+
and <varname>SYSVSEM</varname> are enabled, too. (They are by
908+
default.) The following shows an example of how to set the various
909+
parameters in the kernel configuration file:
886910
<programlisting>
887911
option SYSVSHM
888912
option SHMMAXPGS=4096

0 commit comments

Comments
 (0)