[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC 08/10] xen/balloon: implement migratepage



On Wed, 2014-10-15 at 17:16 +0100, David Vrabel wrote:
> On 15/10/14 16:54, Wei Liu wrote:
> > This patch replaces the xen_balloon_migratepage stub with actual
> > implementation.
> > 
> > It's implemented in two macro steps:
> > 1. populate old page with machine page and remove it from balloon driver
> > 2. give up machine page that backs new page and queue it to balloon
> >    driver
> > 
> > Old page is the page owned by balloon driver, new page is a page
> > isolated by core mm compaction thread.
> > 
> > The aforementioned steps swaps a ballooned out page with a usable page.
> > From guest's point of view, it de-fragments physical address space.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> > ---
> >  drivers/xen/balloon.c |   94 
> > +++++++++++++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 92 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
> > index 815e1d5..112190e 100644
> > --- a/drivers/xen/balloon.c
> > +++ b/drivers/xen/balloon.c
> > @@ -727,13 +727,103 @@ static struct notifier_block balloon_cpu_notifier = {
> >  
> >  static const struct address_space_operations xen_balloon_aops;
> >  #ifdef CONFIG_BALLOON_COMPACTION
> > +/*
> > + * xen_balloon_migratepage - perform the balloon page migration on behalf 
> > of
> > + *                           a compation thread.     (called under page 
> > lock)
> > + * @mapping: the page->mapping which will be assigned to the new migrated 
> > page
> > + * @newpage: page that will replace the isolated page after migration 
> > finishes
> > + * @page   : the isolated (old) page that is about to be migrated to 
> > newpage.
> > + * @mode   : compaction mode -- not used for balloon page migration.
> > + *
> > + * After a ballooned page gets isolated by compaction procedures, this
> > + * is the function that performs the page migration on behalf of a
> > + * compaction thread. The page migration for Xen balloon is done in
> > + * these two macro steps:
> > + *
> > + *  A. back @page with machine page
> > + *  B. release machine that backs @newpage
> 
> If the target if enforced and the guest is above the target.  This
> prevent any compaction.  You need an atomic swap operation.

XENMEM_exchange ought to be usable here I think.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.