Skip to content

Commit f3ff9cb

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 dd4143d commit f3ff9cb

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
@@ -781,7 +781,8 @@ psql: could not connect to server: No such file or directory
781781
<para>
782782
In some cases it might also be necessary to increase
783783
<varname>SEMMAP</> to be at least on the order of
784-
<varname>SEMMNS</>. This parameter defines the size of the semaphore
784+
<varname>SEMMNS</>. If the system has this parameter
785+
(many do not), it defines the size of the semaphore
785786
resource map, in which each contiguous block of available semaphores
786787
needs an entry. When a semaphore set is freed it is either added to
787788
an existing entry that is adjacent to the freed block or it is
@@ -838,7 +839,7 @@ psql: could not connect to server: No such file or directory
838839
</term>
839840
<listitem>
840841
<para>
841-
The default settings can be changed using
842+
The default IPC settings can be changed using
842843
the <command>sysctl</command> or
843844
<command>loader</command> interfaces. The following
844845
parameters can be set using <command>sysctl</command>:
@@ -857,13 +858,9 @@ psql: could not connect to server: No such file or directory
857858
<programlisting>
858859
kern.ipc.semmni=256
859860
kern.ipc.semmns=512
860-
kern.ipc.semmnu=256
861861
</programlisting>
862-
After modifying these values a reboot is required for the new
862+
After modifying that file, a reboot is required for the new
863863
settings to take effect.
864-
(Note: FreeBSD does not use <varname>SEMMAP</>. Older versions
865-
would accept but ignore a setting for <literal>kern.ipc.semmap</>;
866-
newer versions reject it altogether.)
867864
</para>
868865

869866
<para>
@@ -887,7 +884,7 @@ kern.ipc.semmnu=256
887884

888885
<para>
889886
<systemitem class="osname">FreeBSD</> versions before 4.0 work like
890-
<systemitem class="osname">OpenBSD</> (see below).
887+
old <systemitem class="osname">OpenBSD</> (see below).
891888
</para>
892889
</listitem>
893890
</varlistentry>
@@ -902,12 +899,19 @@ kern.ipc.semmnu=256
902899
IPC parameters can be adjusted using <command>sysctl</command>,
903900
for example:
904901
<screen>
905-
<prompt>$</prompt> <userinput>sysctl -w kern.ipc.shmmax=16777216</userinput>
902+
<prompt>#</prompt> <userinput>sysctl -w kern.ipc.semmni=100</userinput>
906903
</screen>
907-
To have these settings persist over reboots, modify
904+
To make these settings persist over reboots, modify
908905
<filename>/etc/sysctl.conf</filename>.
909906
</para>
910907

908+
<para>
909+
You will usually want to increase <literal>kern.ipc.semmni</literal>
910+
and <literal>kern.ipc.semmns</literal>,
911+
as <systemitem class="osname">NetBSD</systemitem>'s default settings
912+
for these are uncomfortably small.
913+
</para>
914+
911915
<para>
912916
You might also want to configure your kernel to lock shared
913917
memory into RAM and prevent it from being paged out to swap.
@@ -916,10 +920,10 @@ kern.ipc.semmnu=256
916920
</para>
917921

918922
<para>
919-
<systemitem class="osname">NetBSD</> versions before 5.0 work like
920-
<systemitem class="osname">OpenBSD</> (see below), except that
921-
parameters should be set with the keyword <literal>options</> not
922-
<literal>option</>.
923+
<systemitem class="osname">NetBSD</systemitem> versions before 5.0
924+
work like old <systemitem class="osname">OpenBSD</systemitem>
925+
(see below), except that kernel parameters should be set with the
926+
keyword <literal>options</literal> not <literal>option</literal>.
923927
</para>
924928
</listitem>
925929
</varlistentry>
@@ -930,11 +934,31 @@ kern.ipc.semmnu=256
930934
</term>
931935
<listitem>
932936
<para>
933-
The options <varname>SYSVSHM</> and <varname>SYSVSEM</> need
934-
to be enabled when the kernel is compiled. (They are by
935-
default.) The maximum size of shared memory is determined by
936-
the option <varname>SHMMAXPGS</> (in pages). The following
937-
shows an example of how to set the various parameters:
937+
In <systemitem class="osname">OpenBSD</systemitem> 3.3 and later,
938+
IPC parameters can be adjusted using <command>sysctl</command>,
939+
for example:
940+
<screen>
941+
<prompt>#</prompt> <userinput>sysctl kern.seminfo.semmni=100</userinput>
942+
</screen>
943+
To make these settings persist over reboots, modify
944+
<filename>/etc/sysctl.conf</filename>.
945+
</para>
946+
947+
<para>
948+
You will usually want to
949+
increase <literal>kern.seminfo.semmni</literal>
950+
and <literal>kern.seminfo.semmns</literal>,
951+
as <systemitem class="osname">OpenBSD</systemitem>'s default settings
952+
for these are uncomfortably small.
953+
</para>
954+
955+
<para>
956+
In older <systemitem class="osname">OpenBSD</systemitem> versions,
957+
you will need to build a custom kernel to change the IPC parameters.
958+
Make sure that the options <varname>SYSVSHM</varname>
959+
and <varname>SYSVSEM</varname> are enabled, too. (They are by
960+
default.) The following shows an example of how to set the various
961+
parameters in the kernel configuration file:
938962
<programlisting>
939963
option SYSVSHM
940964
option SHMMAXPGS=4096

0 commit comments

Comments
 (0)