[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86/mm: Take care of domain reference for shared pages
# HG changeset patch # User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> # Date 1333620363 -3600 # Node ID d690c7e896a26c54a5ab85458824059de72d5cba # Parent 80e3ac42e5a1f1974afaff0292b69199dba589cb x86/mm: Take care of domain reference for shared pages Making a page sharable removes it from the previous owner's list. Making it private adds it. These actions are similar to freeing or allocating a page. Except that they were not minding the domain reference that is taken/dropped when the first/last page is allocated/freed. Without fixing this, a domain might remain zombie when destroyed if all its pages are shared. Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> Acked-by: Tim Deegan <tim@xxxxxxx> Committed-by: Tim Deegan <tim@xxxxxxx> --- diff -r 80e3ac42e5a1 -r d690c7e896a2 xen/arch/x86/mm/mem_sharing.c --- a/xen/arch/x86/mm/mem_sharing.c Tue Apr 03 17:22:59 2012 +0200 +++ b/xen/arch/x86/mm/mem_sharing.c Thu Apr 05 11:06:03 2012 +0100 @@ -401,6 +401,7 @@ static int page_make_sharable(struct dom struct page_info *page, int expected_refcnt) { + int drop_dom_ref; spin_lock(&d->page_alloc_lock); /* Change page type and count atomically */ @@ -430,8 +431,12 @@ static int page_make_sharable(struct dom page_set_owner(page, dom_cow); d->tot_pages--; + drop_dom_ref = (d->tot_pages == 0); page_list_del(page, &d->page_list); spin_unlock(&d->page_alloc_lock); + + if ( drop_dom_ref ) + put_domain(d); return 0; } @@ -466,7 +471,8 @@ static int page_make_private(struct doma ASSERT(page_get_owner(page) == dom_cow); page_set_owner(page, d); - d->tot_pages++; + if ( d->tot_pages++ == 0 ) + get_domain(d); page_list_add_tail(page, &d->page_list); spin_unlock(&d->page_alloc_lock); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |