Merge tag 'for-linus-5.1a-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / drivers / xen / xen-balloon.c
index 2acbfe104e464ab0d8e59bb5ff1862ce08411ed0..a67236b024522732a2e7cc8e9861ad9c46c87141 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/mm_types.h>
 #include <linux/init.h>
 #include <linux/capability.h>
+#include <linux/memory_hotplug.h>
 
 #include <xen/xen.h>
 #include <xen/interface/xen.h>
 
 #define BALLOON_CLASS_NAME "xen_memory"
 
+#ifdef CONFIG_MEMORY_HOTPLUG
+u64 xen_saved_max_mem_size = 0;
+#endif
+
 static struct device balloon_dev;
 
 static int register_balloon(struct device *dev);
@@ -63,6 +68,12 @@ static void watch_target(struct xenbus_watch *watch,
        static bool watch_fired;
        static long target_diff;
 
+#ifdef CONFIG_MEMORY_HOTPLUG
+       /* The balloon driver will take care of adding memory now. */
+       if (xen_saved_max_mem_size)
+               max_mem_size = xen_saved_max_mem_size;
+#endif
+
        err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
        if (err != 1) {
                /* This is ok (for domain0 at least) - so just return */