From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andres Lagar-Cavilla Subject: [PATCH 1 of 2] x86/mem_sharing: Fix saved mfns stat for failed unsharing Date: Tue, 24 Apr 2012 15:20:18 -0400 Message-ID: <5be9a05f17fd38f9c09f.1335295218@xdev.gridcentric.ca> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: andres@gridcentric.ca, tim@xen.org List-Id: xen-devel@lists.xenproject.org xen/arch/x86/mm/mem_sharing.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 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 diff -r 8a6f6d38cb84 -r 5be9a05f17fd xen/arch/x86/mm/mem_sharing.c --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -1205,6 +1205,8 @@ int __mem_sharing_unshare_page(struct do 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