This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] How to deallocate memory shared between domain and xen

To: "Santos, Jose Renato G" <joserenato.santos@xxxxxx>
Subject: Re: [Xen-devel] How to deallocate memory shared between domain and xen
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Wed, 10 Aug 2005 10:10:16 +0100
Cc: Jose Renato Santos <jsantos@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 10 Aug 2005 09:04:09 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <6C21311CEE34E049B74CC0EF339464B924B44B@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <6C21311CEE34E049B74CC0EF339464B924B44B@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

On 10 Aug 2005, at 02:53, Santos, Jose Renato G wrote:

  This seems to be working fine.
  Now, I am not sure what is the sequence of operations to deallocate
  shared pages when they are not needed anymore. I spent sometime
  looking at the code but I still don't have a clear understanding
  of how memory is managed in Xen.

  Any help is greatly appreciated, as will save me a lot of time ...

You want to be able to deallocate them before the domain you were sharing with is destroyed? There are no existing examples in Xen of how that would be done (things like grant-table pages and shared_info page are all destroyed after the domain dies).

Is this the kind of thing you are looking for?:
 1. On allocaction: SHARE_PFN_WITH_DOMAIN(); get_page();
 2. On deallocation: put_page()

...and then the pages get freed up automatically when the guest has freed all references. That is: the pages do not get freed until you have given up your one reference (put_page) and the guest has given up its references.

This can be added quite easily, but will require an new page flag.

 -- Keir

Xen-devel mailing list