Jens Nerche wrote:

> Unless the host does swapping to hard disk, we can assume that
> it has enough memory. Think, most os kernels will provide
> information about used space on swap partitions/files. And also
> the user can give hints whether a host application would run
> much faster if it would have more memory...

Agreed.  The ratio SwapFree/SwapTotal with total system
memory factored in, seems like a reasonable controlling parameter.

Even without any knowlege of the virtual memory demands
on the host-side, I think we can do fairly well.  If we
keep a little extra info about the guest pages, such as
a time stamp (say from RDTSC), then we can decide
intelligently not to put actively used pages in the
can-be-swapped pool.

Worst case, is that not-used-in-awhile guest pages cause
a page fault the first time they are used again.

Granted an LRU algorithm doesn't always do a perfect
job, I believe this would do a decent job.

What the user could tweek here, is the time delta controlling
what the swapping elgibility algorithm thinks is
'not-use-in-awhile'.  Perhaps a value of 0 (meaning infinity)
would mean don't bother - keep all pages locked down.  Other
values mean how many seconds before a page is considered old.

Of course, we don't need to implement this at the moment,
but it's good to think about along the way.  Though, for
some uses, I think this is going to be useful/important:

  - For the casual single VM user, I'm sure they would appreciate
    if they could just leave a VM running in the background, sleeping
    for the most part.  To them it's just an icon on their desktop.
    This way they don't have to boot Windows for every small use.
    Our algorithm would work well, since a lot of the guest would be
    inactive, and thus marked elgible for host paging.  If we can
    save CPU cycles like I mentioned before, the user has a really
    low VM system impact in "sleep mode".

  - For the power multiple VM (ab)user.  Perhaps people will even
    set up VM server machines, and run a good number of VMs.
    We'll need to be able to run our VM without all the pages
    being locked down, or we'll quickly carve up and lock down
    all the system memory.

-Kevin

Reply via email to