# resetting shmmax parameters



## jaymax (Feb 13, 2010)

Hello,


```
FreeBSD O/S 7.2 i386 1CPU AMD

Server memory
RAM memory
	hw.physmem: 1060540416

# sysctl -a | grep shm
   kern.ipc.shm_allow_removed: 0
   kern.ipc.shm_use_phys: 0
   kern.ipc.shmall: 8192
   kern.ipc.shmseg: 128
   kern.ipc.shmmni: 192
   kern.ipc.shmmin: 1
   kern.ipc.shmmax: 33554432

From dmesg
# grep memory /var/run/dmesg.boot
real memory  = 1073676288 (1023 MB)
avail memory = 1036972032 (988 MB)

# swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ad0s1b       1536000       32  1535968     0%
/dev/ad1s1b       1048576       28  1048548     0%
/dev/ad4s1b       2072576       44  2072532     0%
Total             4657152      104  4657048     0%
```


program suggested parameters for shared memory

To reset the parameters:

```
vi /etc/sysconfigtab    in order to add the lines
      ipc:
          shm-max=2147483647
          sem-mni=128
```

What is a safe / comfortable shmmax to use?  
Can I increase shmmax on the fly as in Linux or do I have to do reboot?


Thanks!


----------



## dennylin93 (Feb 13, 2010)

Not sure about the recommend limit, but you should be able to increase it without rebooting.

Usually these are set by adding the parameters into /etc/sysctl.conf.

For example (recommended values for multimedia/totem):

```
kern.ipc.shmmax=67108864
kern.ipc.shmall=32768
```

If your system works fine, then it's probably ok to leave kern.ipc.shmmax alone though.


----------



## anomie (Feb 13, 2010)

After updating /etc/sysctl.conf, as mentioned, simply run the command: 
`# /etc/rc.d/sysctl reload`


----------



## jaymax (Feb 14, 2010)

Prior to parameter reset ==>


```
mach# sysctl -a | grep shmmax
kern.ipc.shmmax: 33554432
mach#
```

After resetting parameters ==>


```
mach# cat /etc/sysctl.conf
# $FreeBSD: src/etc/sysctl.conf,v 1.8.32.1 2009/04/15 03:14:26 kensmith Exp $
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
kern.module_path=/boot/kernel;/boot/modules;/usr/local/modules
kernel.shmmax = 1610612736
```

Reloading


```
mach# /etc/rc.d/sysctl reload
mach#
```

Other attempts

```
mach# sysctl -a | grep shmmax
kern.ipc.shmmax: 33554432
mach#
mach#  /etc/rc.d/sysctl restart
mach#
mach# sysctl -a | grep shmmax
kern.ipc.shmmax: 33554432
mach#
mach# /etc/rc.d/sysctl force reload
Usage: /etc/rc.d/sysctl [fast|force|one](start|stop|restart|rcvar|reload|lastload)
mach#
mach# sysctl -a | grep shmmax
kern.ipc.shmmax: 33554432
```

kern.ipc.shmmax: 33554432 apparently unchanged !!!
Which is the default 32 Mb size

BTW: Apparently physical RAM memory + swap determines capacity for SHMMAX


----------



## dennylin93 (Feb 14, 2010)

The parameter in /etc/sysctl.conf has to be the same as the sysctl one. Change kernel.shmmax to kern.ipc.shmmax.


----------

