From: Arjun Subject: Re: Need info on guest swapping and other things in KVM Date: Sun, 6 Apr 2008 20:30:42 -0400 Message-ID: <896ae46a0804061730v1d4c1d90mf25ea95bb2e56442@mail.gmail.com> References: <896ae46a0804041718i52fa31b9vfcdbb419edce79cc@mail.gmail.com> <47F87E1B.7050208@qumranet.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1407471256==" To: kvm-devel@lists.sourceforge.net, "Avi Kivity" Return-path: In-Reply-To: <47F87E1B.7050208@qumranet.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org --===============1407471256== Content-Type: multipart/alternative; boundary="----=_Part_10742_20333072.1207528242640" ------=_Part_10742_20333072.1207528242640 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Avi, Thanks for your response. Regarding the query on "Guest Swapping", I'm referring to the mechanism that the KVM host can use to swap out a guest's pages. Since a guest OS will have its own swapping mechanism, then how will the host ensure that if it choses to swap out a guest's page, it will not conflict with the guest's own swapping mechanism. Put another way: I understand (from docs, mailing list etc.) that KVM allows the host to overbook/overcommit physical memory via the guest swapping mechanism. i.e. the guest thinks it has x number of physical pages but actually the host has swapped out some of the guests pages and given the freed up physical memory to another guest VM. So the guest actually has less than x pages in physical memory but doesn't know it. It possible that my understanding of the way KVM works may be incorrect, in that case any clarifications would be appreciated. Thanks again Arjun On Sun, Apr 6, 2008 at 3:39 AM, Avi Kivity wrote: > Arjun wrote: > > > Hi Folks, > > > > A fellow student and I wish to do run some experiments with KVM. > > Specifically, we would like to examine > > KVM's guest paging/swapping mechanism, make some changes and run some > > tests. After a brief search through > > the docs and code, we would greatly appreciate help with the following: > > > > 1) Guest Paging : What is the selection mechanism used by KVM for > > evicting a guest's page ? > > > > With mmu notifiers (not yet merged), pages are picked by the normal Linux > LRU mechanism. > > What if there are any conflicts between host and guest as to which page > > to evict ? > > > > > I don't understand this question. > > 2) Where can we find the code for the above (guest paging). > > > > It's the normal Linux swapping code. > > > > 3) Are the KVM guests scheduled by the (hosts) standard linux scheduler > > ? It appears that this > > is the case but I want to be sure. > > > > Yes. > > > > 4) Have there been any changes to the host's page/buffer cache ? Are > > there any changes planned ? > > > > > Yes, mmu notifiers. This doesn't change pagecache, but rather allows > kvm's shadow mmu to be synchronized to the main Linux mmu, which is what > allows page eviction and page aging to work. > > -- > error compiling committee.c: too many arguments to function > > ------=_Part_10742_20333072.1207528242640 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Avi,
Thanks for your response.

Regarding the query on "Guest Swapping", I'm referring to the mechanism that the KVM host can use to swap out a guest's pages. Since a guest OS will have its own swapping mechanism, then how will the host ensure that if it choses to swap out a guest's page, it will not conflict with the guest's own swapping mechanism.
Put another way: I understand (from docs, mailing list etc.) that KVM allows the host to overbook/overcommit physical memory via the guest swapping mechanism. i.e. the guest thinks it has x number of physical pages but actually the host has swapped out some of the guests pages and given the freed up physical memory to another guest VM. So the guest actually has less than x pages in physical memory but doesn't know it.

It possible that my understanding of the way KVM works may be incorrect, in that case any clarifications would be appreciated.

Thanks again
Arjun



On Sun, Apr 6, 2008 at 3:39 AM, Avi Kivity <avi@qumranet.com> wrote:
Arjun wrote:
Hi Folks,

A fellow student and I wish to do run some experiments with KVM. Specifically, we would like to examine
KVM's guest paging/swapping mechanism, make some changes and run some tests. After a brief search through
the docs and code, we would greatly appreciate help with the following:

1) Guest Paging : What is the selection mechanism used by KVM for evicting a guest's page ?

With mmu notifiers (not yet merged), pages are picked by the normal Linux LRU mechanism.


What if there are any conflicts between host and guest as to which page to evict ?


I don't understand this question.


2) Where can we find the code for the above (guest paging).

It's the normal Linux swapping code.



3) Are the KVM guests scheduled by the (hosts) standard linux scheduler ? It appears that this
is the case but I want to be sure.

Yes.



4) Have there been any changes to the host's page/buffer cache ? Are there any changes planned ?


Yes, mmu notifiers.  This doesn't change pagecache, but rather allows kvm's shadow mmu to be synchronized to the main Linux mmu, which is what allows page eviction and page aging to work.

--
error compiling committee.c: too many arguments to function


------=_Part_10742_20333072.1207528242640-- --===============1407471256== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone --===============1407471256== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel --===============1407471256==--