From 77ece196fa5d0ee037cea3b8755e94b42aac4ec0 Mon Sep 17 00:00:00 2001 From: Andres Lagar-Cavilla Date: Thu, 26 Apr 2012 10:03:08 +0100 Subject: [PATCH] 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 --- xen/arch/x86/mm/mem_sharing.c | 2 ++ 1 file changed, 2 insertions(+) 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 -- 2.39.5