diff options
author | Andres Lagar-Cavilla <andres@lagarcavilla.org> | 2012-02-02 12:27:31 +0000 |
---|---|---|
committer | Andres Lagar-Cavilla <andres@lagarcavilla.org> | 2012-02-02 12:27:31 +0000 |
commit | 8821d9e6433021ca39dea706283cff659a8fe91e (patch) | |
tree | d37ad403e8ecea92f6d5d56adae04ab6cda639a1 | |
parent | 1a1ebb096b838a136ebab2966244e9aed701ca68 (diff) | |
download | xen-8821d9e6433021ca39dea706283cff659a8fe91e.tar.gz xen-8821d9e6433021ca39dea706283cff659a8fe91e.tar.bz2 xen-8821d9e6433021ca39dea706283cff659a8fe91e.zip |
x86/mm: Fix balooning+sharing
Never mind that ballooning a shared page makes no sense. We still fix it
because it may be exercised.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
-rw-r--r-- | xen/common/memory.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/xen/common/memory.c b/xen/common/memory.c index 8793894b3f..b47e2447c7 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -183,14 +183,14 @@ int guest_remove_page(struct domain *d, unsigned long gmfn) page = mfn_to_page(mfn); #ifdef CONFIG_X86 - /* If gmfn is shared, just drop the guest reference (which may or may not - * free the page) */ - if(p2m_is_shared(p2mt)) + if ( p2m_is_shared(p2mt) ) { - put_page_and_type(page); - guest_physmap_remove_page(d, gmfn, mfn, 0); - put_gfn(d, gmfn); - return 1; + /* Unshare the page, bail out on error. We unshare because + * we might be the only one using this shared page, and we + * need to trigger proper cleanup. Once done, this is + * like any other page. */ + if ( mem_sharing_unshare_page(d, gmfn, 0) ) + return 0; } #endif /* CONFIG_X86 */ |