From: Roger Pau Monne Date: Mon, 30 Mar 2020 15:54:11 +0000 (+0200) Subject: (no commit message) X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Fwip.balloon2;p=people%2Froyger%2Flinux.git --- diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 0c142bcab79d..8f3becb2c01e 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -631,6 +631,12 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) out_undo: mutex_unlock(&balloon_mutex); free_xenballooned_pages(pgno, pages); + /* + * NB: free_xenballooned_pages will only subtract pgno pages, but since + * target_unpopulated is incremented with nr_pages at the start we need + * to remove the remaining ones also, or accounting will be screwed. + */ + balloon_stats.target_unpopulated -= nr_pages - pgno; return ret; } EXPORT_SYMBOL(alloc_xenballooned_pages);