# Shared memory and Linux program  problem



## cutter (Mar 14, 2012)

I have configured on FreeBSD (release 9.0 32bit with 4GB) shared memory as follows:


```
kern.ipc.shm_allow_removed: 0
kern.ipc.shm_use_phys: 0
kern.ipc.shmall: 1048576
kern.ipc.shmseg: 256
kern.ipc.shmmni: 1024
kern.ipc.shmmin: 2
kern.ipc.shmmax: 2147479553
kern.features.sysv_shm: 1
kern.features.posix_shm: 1
kern.ipc.semaem: 16384
kern.ipc.semvmx: 32767
kern.ipc.semusz: 616
kern.ipc.semume: 50
kern.ipc.semopm: 256
kern.ipc.semmsl: 250
kern.ipc.semmnu: 150
kern.ipc.semmns: 32000
kern.ipc.semmni: 512
kern.features.sysv_sem: 1
vfs.acl_nfs4_old_semantics: 0
p1003_1b.semaphores: 0
p1003_1b.sem_nsems_max: 0
p1003_1b.sem_value_max: 0
```

which corresponds to approximately 2GB, half of the memory. I am running Oracle 10g Linux (linux_base-f10 installed) on it, but I can't attribute more than 700MB to oracle.


```
SQL> startup
ORACLE instance started.

Total System Global Area  734003200 bytes
Fixed Size                  1269664 bytes
Variable Size             356515936 bytes
Database Buffers          369098752 bytes
Redo Buffers                7118848 bytes
Database mounted.
Database opened.
```

Any attempt to increase its memory usage above 710MB results in "Linux cannot allocate memory" remark. The *ipcs* output gets me no further to understand the problem. It shows the exact amount of shared memory used by oracle. 

```
ipcs -a
Message Queues:
T           ID          KEY MODE        OWNER    GROUP    CREATOR  CGROUP                 CBYTES                 QNUM               QBYTES        LSPID        LRPID STIME    RTIME    CTIME

Shared Memory:
T           ID          KEY MODE        OWNER    GROUP    CREATOR  CGROUP         NATTCH        SEGSZ         CPID         LPID ATIME    DTIME    CTIME
m        65536    862830884 --rw-r----- oracle   dba      oracle   dba                17    [B]734011392[/B]         1745         1799 22:19:40 22:25:24 22:18:38

Semaphores:
T           ID          KEY MODE        OWNER    GROUP    CREATOR  CGROUP          NSEMS OTIME    CTIME
s       262144   -786380120 --rw-r----- oracle   dba      oracle   dba               154 15:36:47 22:18:38
```

My question is whether the shared memory declared by sysctl output is really 2GB and can it be checked by other means to verify it? How much shared memory is seen by the Linuxolator? By what means this can be checked? Do you see any wrong in my memory definitions and can you suggest how to solve the riddle?
Thank in advance for any help.


----------



## SirDice (Mar 14, 2012)

If you remove all those sysctl(8) do the values Oracle sees change?


----------



## cutter (Mar 14, 2012)

I don't understand your question. Please be more specific.

All the values you see through "*sysctl -a*" are hardcoded in the kernel. I experimented with nearly every possible and even impossible combination for the last week without avail. The only thing which jumped against my eyes was that 9.0 kernel does not accept SEMMAP option anymore. But my question is still the same: Is there any possibility to know what shared memory see linux. The minimal check in linux is "*cat /proc/kernel*", but here we don't have it unfortunately. I can only know the amount of already shared memory


----------



## cutter (Mar 25, 2012)

Such problem exists only in 9.0 release version. Any other version from 5 through 8.2 does not exhibit such behavior.

I can state for sure the problem lays in the internals of 9.0 release.


----------

