1834150 Members
2428 Online
110064 Solutions
New Discussion

memory swap area?

 
SOLVED
Go to solution
discoverer
Frequent Advisor

memory swap area?

Hello All friends,

In the output of swapinfo -tm:

# swapinfo -tm
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 0 1024 0% 0 - 1 /dev/vg00/lvol2
dev 3072 0 3072 0% 0 - 1 /dev/vg00/lvol4
reserve - 686 -686
memory 1518 317 1201 21%
total 5614 1003 4611 18% - 0 -

The 'memory' row stands for the 'memory swap area'.

But I don't understand that clearly: what's the advantage of using this part of memory as a swap area?

Can some experts tell me the theory?

Thanks!

/discoverer
Listen, then discover, then succeed!
3 REPLIES 3
Steven Sim Kok Leong
Honored Contributor
Solution

Re: memory swap area?

Hi,

The pseudo-swap also known as the memory paging area is the amount of system memory that can be used to hold pages in the event that all of the device/filesystem paging areas are used up.

I personally find no obvious advantages, apart from the faster speed of access via memory and the additional buffer. It is faster because it is performed in memory rather than on your device/filesystem. It provides an additional buffer area to hold your pages, especially when your device/filesystem swap space has been exhausted.

You can disable it by setting the kernel parameter swapmem_on to the value 0 in your kernel.

Hope this helps. Regards.

From the swapinfo man page, it is stated that:
========================================
When a process is created, or requests additional space, space is reserved for it by increasing the reserve swap. When paging activity actually occurs, space is used in one of the paging areas (the one with the lowest priority number that has free space available, already allocated).

The sum of the space used in all of the paging areas, plus the amount of space reserved, can never exceed the total amount allocated in all of the paging areas. If a request for more memory occurs which would cause this to happen, the system tries several options:

1. The system tries to increase the total space available by allocating more space in file system paging areas.

2. If all file system paging areas are completely allocated and the request is still not satisfied, the system will try to use memory paging (Memory paging is ontrolled by the tunable arameter swapmem_on, which defaults to 1 (on). If this parameter is turned off, the memory line will not appear.)

3. If memory paging also cannot satisfy the request, because it is full or turned off, the request is denied.

Note that:

When paging space is allocated to a file system paging area, that space becomes unavailable for user files, even if there is no paging activity to it.
========================================

Hope this helps. Regards.

Steven Sim Kok Leong
Trond Haugen
Honored Contributor

Re: memory swap area?

Here's my 2 cent.
Pseudo swap is usefull if you have loads of RAM and less swap. Otherwise you would most likely not be able to utilize all for your memory.
If you have more swap that RAM set swapmem_on to 0.
In my view there is no point "swapping" to memory when you could have "freed" that memory (swapmem_on=0) and wouldn't have had "swap" at all.
Regards,
Trond Haugen
LinkedIn
Hooi Siew Hoong_1
Frequent Advisor

Re: memory swap area?

This memory swap area is just a pesudo swap. It is just a numerical number for calcutaing swap space and do not exist in reality.

Imagine this scenario, where no pesudo swap is configured. All the processes in the physical memory are flush out to the swap and swap is now 100% full. Now the memory is now 0% used, and swap 100% used, but new process could not start because it could not reserve anymore swap space. This is pretty ineffective since memory is free but new process could not start.

Now we add pesudo swap, there are now additional swap space and the new process could run. The %use for memory in swapinfo does not means anything, the more important figure is the total figure.

No physical memory space is taken up for swap. Just run glance and you will see that under memory utilisation, there is no swap usage.