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???