Hello,
The following series contain some fixes in order to make Xen balloon
memory hotplug function properly. Fix two patches are bugfixes that IMO
should be backported to stable branches, last patch might be more
controversial (to backport) since it includes a small change to the
generic memory hotplug interface.
Thanks, Roger.
Roger Pau Monne (3):
xen/balloon: fix accounting in alloc_xenballooned_pages error path
xen/balloon: make the balloon wait interruptible
memory: introduce an option to force onlining of hotplug memory
drivers/xen/balloon.c | 14 +++++++++++---
include/linux/memory_hotplug.h | 3 ++-
mm/memory_hotplug.c | 16 ++++++++++------
3 files changed, 23 insertions(+), 10 deletions(-)
--
2.27.0
target_unpopulated is incremented with nr_pages at the start of the
function, but the call to free_xenballooned_pages will only subtract
pgno number of pages, and thus the rest need to be subtracted before
returning or else accounting will be skewed.
Signed-off-by: Roger Pau Monné <[email protected]>
Cc: [email protected]
---
Cc: Boris Ostrovsky <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: [email protected]
---
drivers/xen/balloon.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 77c57568e5d7..3cb10ed32557 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -630,6 +630,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);
--
2.27.0