aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/page_alloc.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-12-17 06:27:56 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-12-17 06:27:56 +0000
commit38edca187daf8961d574f0e9cec8d775f6271e35 (patch)
treeb68271b7a481e18989fd3c769a91cd48139309ee /xen/common/page_alloc.c
parent287d07f6a7b84d9caf6e734f987a02ef5de7561c (diff)
downloadxen-38edca187daf8961d574f0e9cec8d775f6271e35.tar.gz
xen-38edca187daf8961d574f0e9cec8d775f6271e35.tar.bz2
xen-38edca187daf8961d574f0e9cec8d775f6271e35.zip
This patch defines a new PGT type called PGT_shared_page and a new synthetic
domain called 'dom_cow'. In order to share a page, the type needs to be changed to PGT_shared_page and the owner to dom_dow. Only pages with PGT_none, and no type count are allowed to become sharable. Conversly, sharable pages can only be made 'private' if type count equals one. page_make_sharable() and page_make_private() handle these transitions. Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
Diffstat (limited to 'xen/common/page_alloc.c')
-rw-r--r--xen/common/page_alloc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index cb2d99cae5..19a7bd24d1 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1145,7 +1145,7 @@ void free_domheap_pages(struct page_info *pg, unsigned int order)
spin_unlock_recursive(&d->page_alloc_lock);
}
- else if ( likely(d != NULL) )
+ else if ( likely(d != NULL) && likely(d != dom_cow) )
{
/* NB. May recursively lock from relinquish_memory(). */
spin_lock_recursive(&d->page_alloc_lock);
@@ -1172,6 +1172,13 @@ void free_domheap_pages(struct page_info *pg, unsigned int order)
free_heap_pages(pg, order);
}
+ else if ( unlikely(d == dom_cow) )
+ {
+ ASSERT(order == 0);
+ scrub_one_page(pg);
+ free_heap_pages(pg, 0);
+ drop_dom_ref = 0;
+ }
else
{
/* Freeing anonymous domain-heap pages. */