Operating System - HP-UX
1834150 Members
2196 Online
110064 Solutions
New Discussion

Re: shared memory and memory free reported by swapinfo.

 
Jdamian
Respected Contributor

shared memory and memory free reported by swapinfo.

Hi guys

I always thought the shared memory never is swapped but now I'm not sure.

An Oracle DB runs in my box. DB uses shared memory (SGA). Its size is near 1 GB (I removed non request lines from the following output) :
# ipcs -ma
T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:
m 538627 0xb87b04f4 --rw-r----- oracle dba oracle dba 23 1094467584 5459 5807 14:33:40 14:38:45 13:56:03

but "swapinfo -tam" reports
# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 5 1019 0% 0 - 1 /dev/vg00/lvol2
dev 1024 5 1019 0% 0 - 1 /dev/vg00/lvol13
reserve - 1156 -1156
memory 1472 383 1089 26%
total 3520 1549 1971 44% - 0 -

How is it possible ? If 1472 MB are available to user processes and a user process locks near 1024 MB (I always understood shared memory is not swapable and "free memory" in swapinfo output meant "memory for hold swapable pages") ... how is it possible there are 1089 MB free ?...

Kmeminfo reports:

Physmem = 524288 Available physical memory:
Freemem = 50605 Free physical memory
Used = 473683 Used physical memory:
System = 154440 by kernel:
Static = 34379 for text and static data
Dynamic = 66586 for dynamic data
Bufcache = 52428 for file-system buffer cache
Eqmem = 23 for equiv. mapped page pool
SCmem = 1024 for system critical page pool
User = 308949 by user processes
Uarea = 2372 for thread uareas
Disowned = 13474 disowned pages

Physical Memory: 524288 pages (2 GB)
Memory used by System: 154440 pages (600 MB).
Then, initial memory amount for user processes are near 1450 MB (it matches the field "Mb AVAIL" in swapinfo output).
Later, when Oracle process gets near 1 GB of shared memory... the number of free memory reported by swapinfo should be decreased in 1 GB, shouldn't it ?

I also find near 1 GB of 'reserved' memory... but "shared memory" is locked and never swaped, isn't it ?
4 REPLIES 4
Nicolas Dumeige
Esteemed Contributor

Re: shared memory and memory free reported by swapinfo.

Hello,

If pages are locked, they will not be swapped. The locking mechanism is OS dependant.

Cheers

Nicolas
All different, all Unix
Nicolas Dumeige
Esteemed Contributor

Re: shared memory and memory free reported by swapinfo.

Take a look at :

http://aa11.cjb.net/hpux_admin/2000/04/0317.html
All different, all Unix
Stefan Farrelly
Honored Contributor

Re: shared memory and memory free reported by swapinfo.

Normally Oracle locks its SGA (shared memory pool) so its not eligible for paging, its set that way on all our servers. for some reason its unlocked on yours, perhaps becauase you have so little memory ? and in fact your are out of memory (some stuff is paged out - USED column under DEV from swapinfo). If you reconfigure your oracle SGA to be locked in memory you will have so little memory for user processes that your performance will go out the windows - so dont lock it unless you reduce it in size or add more ram.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Jdamian
Respected Contributor

Re: shared memory and memory free reported by swapinfo.

I think something happens because syslog.log shows "mlock_region failed" and alert.log of Oracle DB show "err-600".

I have other box (2 GB) where another Oracle DB is running and this problem doesn't ocurr (memory used is near 100%).