The documentation on changing shared memory kernel settings on xBSD
(namely FreeBSD, possibly others as well) isn't ideal, IMHO. It says:

%%
     The options SYSVSHM and SYSVSEM need to be enabled when the
     kernel is compiled. (They are by default.) The maximum size of
     shared memory is determined by the option SHMMAXPGS (in
     pages). The following shows an example of how to set the various
     parameters:

options         SYSVSHM
options         SHMMAXPGS=4096
options         SHMSEG=256

options         SYSVSEM
options         SEMMNI=256
options         SEMMNS=512
options         SEMMNU=256
options         SEMMAP=256

    (On NetBSD and OpenBSD the key word is actually option singular.)

    You may also want to use the sysctl setting to lock shared memory
    into RAM and prevent it from being paged out to swap.
%%

However, it appears that shared memory & semaphore settings can also
be controlled via sysctls -- at least on a FreeBSD 4.7-RELEASE box, I
can see:

kern.ipc.semmap: 30
kern.ipc.semmni: 10
kern.ipc.semmns: 60
kern.ipc.semmnu: 30
kern.ipc.semmsl: 60
kern.ipc.semopm: 100
kern.ipc.semume: 10
kern.ipc.semusz: 92
kern.ipc.semvmx: 32767
kern.ipc.semaem: 16384
kern.ipc.shmmax: 33554432
kern.ipc.shmmin: 1
kern.ipc.shmmni: 192
kern.ipc.shmseg: 128
kern.ipc.shmall: 8192
kern.ipc.shm_use_phys: 0

However, the FreeBSD box I'm playing with isn't mine, so I'm not too
keen to change sysctls (well, that and I don't have root :-) ). Would
a kind BSD user confirm that:

        (a) the sysctls above *can* be used to change kernel shared
            memory settings, and the default value of the sysctl is
            the kernel option referred to in the docs.

        (b) do the above sysctls work on NetBSD and OpenBSD as well?

        (c) the 'prevent shared memory paging' sysctl vaguely referred
            to in the docs is 'kern.ipc.shm_use_phys', right?

        (d) does the above sysctl also work on NetBSD and OpenBSD?

Thanks in advance,

Neil

-- 
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC


20 Nov 2002 23:48:47 -0500
Neil Conway <neilc@samurai.com>
xBSD shmem doc deficiency
On 20 Nov 2002, Neil Conway wrote:

> However, the FreeBSD box I'm playing with isn't mine, so I'm not too
> keen to change sysctls (well, that and I don't have root :-) ). Would
> a kind BSD user confirm that:
> 
>         (a) the sysctls above *can* be used to change kernel shared
>             memory settings, and the default value of the sysctl is
>             the kernel option referred to in the docs.
> 
>         (b) do the above sysctls work on NetBSD and OpenBSD as well?

A quick look at OpenBSD 3.2 (man 3 sysctl) appears to show that all you
can do at runtime is enable/disable message queues, shared memory, and
semaphores, not adjust buffer counts or sizes. It seems the kernel must 
still be recompiled with the desired new settings.

Jon


Thu, 21 Nov 2002 05:14:25 +0000 (UTC)
Jon Jensen <jon@endpoint.com>
Re: xBSD shmem doc deficiency

Apparently only some settings are adjustable.

root@dev:~# uname -smr
FreeBSD 4.2-RELEASE i386
root@dev:~# sysctl -a | grep kern.ipc.semm
kern.ipc.semmap: 30
kern.ipc.semmni: 10
kern.ipc.semmns: 60
kern.ipc.semmnu: 30
kern.ipc.semmsl: 60
root@dev:~# sysctl -w kern.ipc.semmap=50
kern.ipc.semmap: 30 -> 50
root@dev:~# sysctl -w kern.ipc.semmni=50
sysctl: oid 'kern.ipc.semmni' is read only
root@dev:~#


On 20 Nov 2002, Neil Conway wrote:

> The documentation on changing shared memory kernel settings on xBSD
> (namely FreeBSD, possibly others as well) isn't ideal, IMHO. It says:
>
> %%
>      The options SYSVSHM and SYSVSEM need to be enabled when the
>      kernel is compiled. (They are by default.) The maximum size of
>      shared memory is determined by the option SHMMAXPGS (in
>      pages). The following shows an example of how to set the various
>      parameters:
>
> options         SYSVSHM
> options         SHMMAXPGS=4096
> options         SHMSEG=256
>
> options         SYSVSEM
> options         SEMMNI=256
> options         SEMMNS=512
> options         SEMMNU=256
> options         SEMMAP=256
>
>     (On NetBSD and OpenBSD the key word is actually option singular.)
>
>     You may also want to use the sysctl setting to lock shared memory
>     into RAM and prevent it from being paged out to swap.
> %%
>
> However, it appears that shared memory & semaphore settings can also
> be controlled via sysctls -- at least on a FreeBSD 4.7-RELEASE box, I
> can see:
>
> kern.ipc.semmap: 30
> kern.ipc.semmni: 10
> kern.ipc.semmns: 60
> kern.ipc.semmnu: 30
> kern.ipc.semmsl: 60
> kern.ipc.semopm: 100
> kern.ipc.semume: 10
> kern.ipc.semusz: 92
> kern.ipc.semvmx: 32767
> kern.ipc.semaem: 16384
> kern.ipc.shmmax: 33554432
> kern.ipc.shmmin: 1
> kern.ipc.shmmni: 192
> kern.ipc.shmseg: 128
> kern.ipc.shmall: 8192
> kern.ipc.shm_use_phys: 0
>
> However, the FreeBSD box I'm playing with isn't mine, so I'm not too
> keen to change sysctls (well, that and I don't have root :-) ). Would
> a kind BSD user confirm that:
>
>         (a) the sysctls above *can* be used to change kernel shared
>             memory settings, and the default value of the sysctl is
>             the kernel option referred to in the docs.
>
>         (b) do the above sysctls work on NetBSD and OpenBSD as well?
>
>         (c) the 'prevent shared memory paging' sysctl vaguely referred
>             to in the docs is 'kern.ipc.shm_use_phys', right?
>
>         (d) does the above sysctl also work on NetBSD and OpenBSD?
>
> Thanks in advance,
>
> Neil
>
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


Thu, 21 Nov 2002 02:04:34 -0500 (EST)
Kris Jurka <books@ejurka.com>
Re: xBSD shmem doc deficiency
Neil Conway wrote:
>         (c) the 'prevent shared memory paging' sysctl vaguely referred
>             to in the docs is 'kern.ipc.shm_use_phys', right?

I have added a mention of this to the 7.4 docs:

        You might also want to use the <application>sysctl</> setting to
        lock shared memory into RAM and prevent it from being paged out
        to swap, e.g. <literal>kern.ipc.shm_use_phys</>.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Thu, 21 Nov 2002 13:20:17 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: xBSD shmem doc deficiency
Hi Neil,

> However, the FreeBSD box I'm playing with isn't mine, so I'm not too
> keen to change sysctls (well, that and I don't have root :-) ). Would
> a kind BSD user confirm that:
>
>         (a) the sysctls above *can* be used to change kernel shared
>             memory settings, and the default value of the sysctl is
>             the kernel option referred to in the docs.

Unless this has changed in 4.7, lots of those shm sysctls are
read-only...ie. you cannot set the shared memory pool size at runtime.  I'll
look at it again tho.

>         (c) the 'prevent shared memory paging' sysctl vaguely referred
>             to in the docs is 'kern.ipc.shm_use_phys', right?

I'll have to investigate that one...

Chris



Thu, 21 Nov 2002 11:18:20 -0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
Re: xBSD shmem doc deficiency