From: Andres Lagar-Cavilla Date: Thu, 26 Apr 2012 09:03:08 +0000 (+0100) Subject: x86/mem_sharing: Fix saved mfns stat for failed unsharing X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~8551 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=77ece196fa5d0ee037cea3b8755e94b42aac4ec0;p=xen.git x86/mem_sharing: Fix saved mfns stat for failed unsharing If unsharing fails, the decrease of the nr_saved_mfns stat was not being undone. This would result in an underflow of the stat, as the retry would later decrease the counter again. Signed-off-by: Andres Lagar-Cavilla Acked-by: Tim Deegan Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index d4488ec9f6..aec92c6143 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -997,6 +997,8 @@ gfn_found: page = alloc_domheap_page(d, 0); if ( !page ) { + /* Undo dec of nr_saved_mfns, as the retry will decrease again. */ + atomic_inc(&nr_saved_mfns); mem_sharing_page_unlock(old_page); put_gfn(d, gfn); /* Caller is responsible for placing an event