From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH RFC 08/10] xen/balloon: implement migratepage Date: Thu, 16 Oct 2014 10:28:03 +0100 Message-ID: <1413451683.2012.8.camel@citrix.com> References: <1413388459-4663-1-git-send-email-wei.liu2@citrix.com> <1413388459-4663-9-git-send-email-wei.liu2@citrix.com> <543E9DCE.80001@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <543E9DCE.80001@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: boris.ostrovsky@oracle.com, Wei Liu , stefano.stabellini@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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 > > --- > > 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.