Operating System - HP-UX
1833729 Members
2447 Online
110063 Solutions
New Discussion

swapon: The kernel tunable parameter "maxswapchunks" needs to be increased

 
Midrange Systems Unix
Occasional Contributor

swapon: The kernel tunable parameter "maxswapchunks" needs to be increased

I have added 8 GB of swap space and I tried to do a swapon -a and recieved a message of swapon: The kernel tunable parameter "maxswapchunks" needs to be increased. I will need to increase maxswapchunks but by how much. I know that maxswapchunks is 4096 and swapchunks is 2048. I checked ITRC and could not find the awnser. please help.
4 REPLIES 4
Sridhar Bhaskarla
Honored Contributor

Re: swapon: The kernel tunable parameter "maxswapchunks" needs to be increased

Hi,

The math is simple.

Total_swap_that_can_be_configured
=maxswapchunks * swapchunk

On your system, the total swap you can configure is 4096*2048 = 8388608 which is 8 GB.

If you want to add more swap, then calculate the maxswapchunks by the same forumula

total_swap / swchunk

However, the limit for maxswapchunks is 16384. If you need to go beyond that limit, then you will need to increase the swchunk size.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Don Morris_1
Honored Contributor

Re: swapon: The kernel tunable parameter "maxswapchunks" needs to be increased

Check /var/adm/log/syslog.log [or run 'dmesg' if this is recent]. The kernel tells you exactly how much to increase for the failing request.

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

If you're planning several swap additions - then (as mentioned by prior post) the math is pretty straightforward.

Amount of Swap You want = maxswapchunks * swchunk * 1k.

With the default swchunk being 2k, that means maxswapchunks needs to be however much you want divided by 2Mb. [32Gb? 16*1024... 1Gb? 512, etc.]

If anyone's curious... there's a similar message for swchunk on 11i v1.6 and higher (since maxswapchunks doesn't exist anymore as a tunable).
Patrick Wallek
Honored Contributor

Re: swapon: The kernel tunable parameter "maxswapchunks" needs to be increased

I generally try to go ahead and increase maxswapchunks to its maximum value (16384 I think) when I install a new system. It doesn't hurt anything in term of memory usage and it saves me from having to worry about it down the road if I need to add more swap space.
Stuart Abramson_2
Honored Contributor

Re: swapon: The kernel tunable parameter "maxswapchunks" needs to be increased

I agree with Patrick: Run it all the way up. It doesn't hurt.

The formula above is probably right also.

Howerver, as a rule of thumb, this parameter should be set to half of the total Mbytes configured as device swap. Did you get that? Look at this table:

----------------------
<512Mb 256
>512Mb and <768Mb 384
>768Mb and <1Gb 512
>1Gb and <1.25Gb 640
>1.25Gb and <1.5Gb 768
>1.5Gb and <1.75Gb 896
>1.75Gb 1024
5 GB 2500
24 GB 12000

5 GB is 5000 MB, so set maxswapchunks equal to 5000/2 = 2500.

You have to reboot.