Is privvmpages's MAX limited to the amount of RAM on a computer
I can't seem to get a straight answer on this one. After reading these links: http://forum.openvz.org/index.php?t=msg&goto=2594&#m sg_2886 http://maxgarrick.com/understanding-openvz-resource-limits/ http://forum.openvz.org/index.php?t=msg&goto=32000& http://wiki.openvz.org/Privvmpages#privvmpages http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf I am unsure if we can set a VE's privvmpages to more than a system's total RAM. For instance if I have a system that has: 4GB RAM 4GB SWAP *HardwareNode* free -m total used free shared buffers cached Mem: 3926 224 3702 0 4 78 -/+ buffers/cache: 141 3785 Swap: 4094 9 4085 I can run this command. vzctl set 33503 --privvmpages 4G --save Then run "free -m" inside the VE and we will see 4Gs for the system. *VE* $ free -m total used free shared buffers cached Mem: 3926 75 3850 0 0 0 -/+ buffers/cache: 75 3850 Swap: 0 0 0 $ But if I set it to more then 4G it will not show up as system memory. vzctl set 33503 --privvmpages 6G --save *VE* $ free -m total used free shared buffers cached Mem: 3926 75 3850 0 0 0 -/+ buffers/cache: 75 3850 Swap: 0 0 0 $ Thoughts? If the answer is "no". My follow up question is "Why not? Assuming you have enough SWAP to cover it."
Re: Is privvmpages's MAX limited to the amount of RAM on a computer
Also I read this. http://forum.parallels.com/showthread.php?t=59082 But I am still unsure.
Another interesting note. I created some code to malloc and take up about 2G worth of memory. I set the VE to 4G of memory to match the RAM on the hardware node. Then I run the program. As you can see below I can only run the program 2 times before I get a malloc error. vzctl set 33503 --privvmpages 4G *Inside the VE* $ free -m total used free shared buffers cached Mem: 3926 73 3853 0 0 0 -/+ buffers/cache: 73 3853 Swap: 0 0 0 $ $ ./allocateandfill & [1] 32375 $ ./allocateandfill & [2] 32376 $ Success ./allocateandfill & [3] 32377 $ malloc: Cannot allocate memory $ free -m total used free shared buffers cached Mem: 3926 3926 0 0 0 0 -/+ buffers/cache: 3926 0 Swap: 0 0 0 $ So the above error is expected. Then I set the VE to something over the amount of physical ram on the hardware node... vzctl set 33503 --privvmpages 6G *Inside the VE* $ free -m total used free shared buffers cached Mem: 3926 73 3853 0 0 0 -/+ buffers/cache: 73 3853 Swap: 0 0 0 $ NOTICE no change in the total memory!!?!! $ ./allocateandfill & [1] 32483 $ ./allocateandfill & [2] 32484 $ ./allocateandfill & [3] 32485 $ NOTICE no errors! $ free -m total used free shared buffers cached Mem: 3926 3926 0 0 0 0 -/+ buffers/cache: 3926 0 Swap: 0 0 0 $ Memory is totally used up. And it shows just 4Gs. "top" shows the same. *On the Hardware node* free -m total used free shared buffers cached Mem: 3926 3810 116 0 0 8 -/+ buffers/cache: 3800 125 Swap: 4094 1678 2415 Notice the hardware node is using all its ram and half the swap. As expected. It needs to grab 6G from somewhere. So my question: What's up? Why does the VE not show all the memory it has available to it???
Looks like they are coming out with a change to taken into account swap space. http://bugzilla.openvz.org/show_bug.cgi?id=1202