From: Juergen Gross Date: Thu, 12 Dec 2019 14:17:50 +0000 (+0100) Subject: xen/balloon: fix ballooned page accounting without hotplug enabled X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7d3e277cbaf1e76496a0db000136df451718ace2;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git xen/balloon: fix ballooned page accounting without hotplug enabled [ Upstream commit c673ec61ade89bf2f417960f986bc25671762efb ] When CONFIG_XEN_BALLOON_MEMORY_HOTPLUG is not defined reserve_additional_memory() will set balloon_stats.target_pages to a wrong value in case there are still some ballooned pages allocated via alloc_xenballooned_pages(). This will result in balloon_process() no longer be triggered when ballooned pages are freed in batches. Reported-by: Nicholas Tsirakis Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin --- diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 731cf54f75c6..05f9f5983ee1 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -403,7 +403,8 @@ static struct notifier_block xen_memory_nb = { #else static enum bp_state reserve_additional_memory(void) { - balloon_stats.target_pages = balloon_stats.current_pages; + balloon_stats.target_pages = balloon_stats.current_pages + + balloon_stats.target_unpopulated; return BP_ECANCELED; } #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */