Hello
A question for my general knowledge and regarding the training Manage for performance : How an ESX reclaim the VM freed memory.
I explain my question, when a VM needs memory, the VMkernel gives Host Physical Memory to the VM.
The VM uses its Gest Physical Memory to satisfy applications needs. It means, the Host Physical Memory consumption is growing for this particular VM. When the Guest Physical Memory is freed, because applications released it, the guest OS will not really free the memory, but write in his "gest free list" memory pages freed and usable.
So my question is how the VMkernel can free the memory the guest OS has released, because he has no access to the guest os free list. The kernel never considers memory as freed and not anymore used by the VM. It should mean when a VM is in use, its memory consumption grow and never decrease because memory is never know by the kernel as released. I know it's not the case, so how can it happen.
I guess when Balloon driver inflate, all pages in the guest free list is used to satisfy the balloon memory request. It seams a way to free the memory the OS released because free pages are gived to the balloon and the kernel can then use it. But what if the balloon never grows and what if VMware tools are not installed?
Thanks for your help.
Best regards.
==================
Senior Consultant
VMware Instructor
VCP 3-4 / VCI 3-4
==================
>> If I understand you, Vmkernel knows how often/if memory from his allocated list is accessed from the VM OS, and is able to determine if memory pages are active or not (from the VM OS point of view). I guess this mechanism is used to estimate the "active guest memory" displayed on the VM's summary tab.
Correct
>> But you mean this mechanism is used to reclaim non-active memory only in contention situation? Is that right? in a normal situation Vmkernel doesn't reclaim memory (even if he knows it's unaccessed) because of the allocation-deallocation performance cost?
True . As I said previously , there is no performance degradation if memory is not reclaimed during non contention state .
Hope this helps !
If VMware tools is not being installed and memory ballooning does not take into effects all the VM will be starve of memory. In that scenario they will be writting to the swap which is the .vswp and still if it does not resolve then the paging in the OS will take into effect.
iDLE-jAM | VCP 2, VCP 3 & VCP 4
If you found this or any other answer useful please consider the use of the Helpful or correct buttons to award points.
Transparent Page Sharing is one of the methods to avoid redundant page/memory allocation . Balloon driver will not be present if vmware tools are not installed .
If reservation is not specified , the non-reserved memory is always swappable to disk . So whenever there is memory pressure on the host , the old pages are swapped to disk and pages freed from swap is provided to the guest .
We need not worry as long as total memory demand from VM's is less than what is available for them . Once it exceeds , ballooning and swapping is invoked as last means .
Hope this helps .
Hi
Some months after, I precise my question.
I know TPS, Balloon driver, Kernel swapping well. But my question is in a non-contention situation.
Let imagine a VM with 12 GB of RAM.
After powered on, it use only 2 GB, host consumed memory is almost 2 GB.
One day, this VM reclaim 10 GB, the host consumed memory grow to around 10 GB.
The day after, this VM decrease it's RAM consumption to 3 GB. The OS will not zeroed freed memory, but just update is "free memory list".
The VMkernel will never know that 8 GB was released, because hi has no access to the OS free list.
I think he will never reclaim this memory.
The only way for ESX to reclaim memory in the free list is to balloon or swap (because Guest OS will use first free memory or idle memory to satisfy the balloon) or vMotion (it seams only active memory is copied to the target host... how it's possible?!).
Something is not clear for me.
Thank you to help my understanding.
Best regards.
SGrimbuhler.
VCP-VCI
> But my question is in a non-contention situation.
Ok
>The day after, this VM decrease it's RAM consumption to 3 GB. The OS will not zeroed freed memory, but just update is "free memory list". The VMkernel will never know that 8 GB was released, because hi has no access to the OS free list. I think he will never reclaim this memory.
Not exactly . VMkernel can keep track of guest "active" memory from the allocated list . The non active memory from allocated list are a hint that guest might have freed this memory . The cost of deallocating and reallocating on demand is a costlier operation . This may have performance impact if O.S is freeing and requesting memory very rapidly . There is no performance degradation if VMkernel does not reclaim freed memory ( in non-contention situation ) .
>vMotion (it seams only active memory is copied to the target host... how it's possible?!).
I hope the above also answers this question
> The only way for ESX to reclaim memory in the free list is to balloon or swap
If there is no contention , balloon or swap does not occur as previously stated .
Hope this helps
Deepeer a écrit:
Not exactly . VMkernel can keep track of guest "active" memory from the allocated list . The non active memory from allocated list are a hint that guest might have freed this memory . The cost of deallocating and reallocating on demand is a costlier operation . This may have performance impact if O.S is freeing and requesting memory very rapidly . There is no performance degradation if VMkernel does not reclaim freed memory ( in non-contention situation ) .
Hi Deepeer, thank you very much for your answer.
If I understand you, Vmkernel knows how often/if memory from his allocated list is accessed from the VM OS, and is able to determine if memory pages are active or not (from the VM OS point of view). I guess this mechanism is used to estimate the "active guest memory" displayed on the VM's summary tab.
But you mean this mechanism is used to reclaim non-active memory only in contention situation? Is that right? in a normal situation Vmkernel doesn't reclaim memory (even if he knows it's unaccessed) because of the allocation-deallocation performance cost?
thanks for your help.
Stephane.
>> If I understand you, Vmkernel knows how often/if memory from his allocated list is accessed from the VM OS, and is able to determine if memory pages are active or not (from the VM OS point of view). I guess this mechanism is used to estimate the "active guest memory" displayed on the VM's summary tab.
Correct
>> But you mean this mechanism is used to reclaim non-active memory only in contention situation? Is that right? in a normal situation Vmkernel doesn't reclaim memory (even if he knows it's unaccessed) because of the allocation-deallocation performance cost?
True . As I said previously , there is no performance degradation if memory is not reclaimed during non contention state .
Hope this helps !
Also note that most modern OS's have a "garbage collector" thread running in the background which goes through the "free list" and zeroes out the memory. I described that behavior in the following article: http://www.yellow-bricks.com/2011/01/10/how-cool-is-tps/
(note that TPS collapses zero pages as well!)
Duncan
Yellow-bricks.com | HA/DRS technical deepdive - the ebook
Stéphane Grimbuhler wrote:
Vmkernel knows how often/if memory from his allocated list is accessed from the VM OS, and is able to determine if memory pages are active or not (from the VM OS point of view). I guess this mechanism is used to estimate the "active guest memory" displayed on the VM's summary tab.
But you mean this mechanism is used to reclaim non-active memory only in contention situation? Is that right?
Depending on what you really mean, I do not think the "active memory" has any real point when the Vmkernel wants to reclaim memory, since it is only an estimation and only sees what the average amount of memory a VM seems to be using. This list would probably not having any use in the matter of which pages are actually needed in the guest.