General
cancel
Showing results for 
Search instead for 
Did you mean: 

Swap size and maxswapchunks not consistent???

Ray Humpage
Frequent Advisor

Swap size and maxswapchunks not consistent???

I just took over a system and was checking the swap size when I discovered the following:

There is a 4GB device swap area on this machine - yet maxswapchunks is set at 256 and swchunk is set at 2. This should allow a max swap size of 512MB. Yet swapinfo -ta shows a swap device of 4GB. Didn't think this was possible. Any ideas?

Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4194304 0 524288 0% 0 - 1 /dev/vg00/lvol2
reserve - 524288 -524288
memory 6627864 6224628 403236 94%
total 10822168 6748916 403236 62% - 0 -

7 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: Swap size and maxswapchunks not consistent???

Hi:

'maxswpchunks' specifies the number of 'swchunk' blocks that can be allocated. The 'swchunck' size, however is in 1K blocks. Hence (maxswapchunks* swchunk*1024) is the maxiumum amount of swap you can configure.

Regards!

...JRF...
Pete Randall
Outstanding Contributor

Re: Swap size and maxswapchunks not consistent???

Ray,

The only thing that comes to mind is that there's one more piece to the formula. From SAM's help on configurable kernel paramters:

" Total swap space is defined by:

swchunk xmaxswapchunks xDEV_BSIZE

where DEV_BSIZE is 1024 bytes. "

So, if DEV_BSIZE was larger than 1024 bytes, this would account for it, but I'm not sure how DEV_BSIZE would even be changed.


Pete


Pete
Elena Leontieva
Esteemed Contributor

Re: Swap size and maxswapchunks not consistent???

Ray,

I guess you are not using all the swap ( 4GB) configured on your system. Run dmesg to see any warning about this.

Currently you have:
max swap configured = 256 x 1024 x 2048 (Bytes)= 512 MB
In order to be able to use 4000 MB you need to increase maxswapchunks accordingly.
Pete Randall
Outstanding Contributor

Re: Swap size and maxswapchunks not consistent???

Once again from SAM's help on configurable parameters:

"
maxswapchunks xswchunk xDEV_BSIZE

For example, using default values for swchunk (2048) and
maxswapchunks (256), and assuming DEV_BSIZE is 1024
bytes, the total configurable swap space equals 537 Mbytes. "


I can't make these numbers coincide with what Ray is seeing - nor with what James is saying. Would anyone care to clarify?


Pete "Where's My Slide Rule" Randall


Pete
Ray Humpage
Frequent Advisor

Re: Swap size and maxswapchunks not consistent???

Ok - checked through the logs and found a message pertaining to this.

Unable to add all swap for device: Primary Swap
. Increase the tunable parameter maxswapchunks by 1792 and re-configure your system.

It seems that I need to increase maxswapchunks(which I already knew) but it looks like swapinfo is showing what would be allocated instead of what actually is. Which still seems a little strange to me.

Oh well - I will make the change and reboot and just fix it instead of wondering why.

Thanks for the info. Points are on the way.


James R. Ferguson
Acclaimed Contributor

Re: Swap size and maxswapchunks not consistent???

Hi (again) Ray:

Your 'swapinfo' only shows a device swap with 512K. THe 'memory' portion is reported because you have pseudoswap enabled. Don't count this as part of your calculation. It's a fudge factor for the kernel's use only in allowing new processes to spawn.

Regards!

...JRF...
Elena Leontieva
Esteemed Contributor

Re: Swap size and maxswapchunks not consistent???

Ray,

This is correct:

maxswapchunks will be 256 + 1792 = 2048;
max swap space = 2048 x 1024 x 2048 = 4294967296 Bytes = 4194304 Kbytes = 4096 MB.

Elena.