Re: Live memory allocation?

Nolan
2009-03-28T18:26:06Z

Alberto Treviño <alberto <at> byu.edu> writes:
> The problem I've seen with this feature is that Windows guests end up taking
> all of their available memory once they are up and running. For example,
> booting Windows XP in KVM 82 show a steady increase in memory. Then about
> the time the login box is about to appear, memory usage jumps to the maximum
> allowed to the VM (512 MB in this case). I remember reading somewhere
> Windows would try to initialize all memory during boot, causing KVM to
> allocate all memory. VMware, however (and I don't know about VirtualBox)
> knows about this and works around it, making sure memory isn't all allocated
> during the Windows boot process.

Windows does zero all memory at boot, and also runs a idle-priority thread in
the background to zero memory as it is freed. This way it is far less likely to
need to zero a page to satisfy a memory allocation request. Whether or not this
is still a win now that people care about power consumption is an open question.

I suspect the difference of behavior between KVM and VMware is related to
VMware's page sharing. All those zeroed pages can be collapsed into one COW
zero page. I wouldn't be surprised to learn that VMware has heuristics in the
page sharing code specifically for windows guests.

Perhaps KSM would help you? Alternately, a heuristic that scanned for (and
collapsed) fully zeroed pages when a page is faulted in for the first time could
catch these.