[PATCH 3/3] drivers/xen/balloon.c: Xen memory balloon driver with memory hotplug support

Previous thread: [PATCH 2/3] drivers/xen/balloon.c: Various balloon features and fixes by Daniel Kiper on Monday, December 20, 2010 - 6:47 am. (11 messages)

Next thread: [PATCH 1/3] mm: Add add_registered_memory() to memory hotplug API by Daniel Kiper on Monday, December 20, 2010 - 6:46 am. (1 message)
From: Daniel Kiper
Date: Monday, December 20, 2010 - 6:48 am

Features and fixes:
  - new version of memory hotplug patch which supports
    among others memory allocation policies during errors
    (try until success or stop at first error),
  - this version of patch was tested with tmem
    (selfballooning and frontswap) and works
    very well with it,
  - some other minor fixes.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
---
 drivers/xen/Kconfig   |   10 ++
 drivers/xen/balloon.c |  222 ++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 221 insertions(+), 11 deletions(-)

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index 60d71e9..ada8ef5 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -9,6 +9,16 @@ config XEN_BALLOON
 	  the system to expand the domain's memory allocation, or alternatively
 	  return unneeded memory to the system.
 
+config XEN_BALLOON_MEMORY_HOTPLUG
+	bool "Xen memory balloon driver with memory hotplug support"
+	default n
+	depends on XEN_BALLOON && MEMORY_HOTPLUG
+	help
+	  Xen memory balloon driver with memory hotplug support allows expanding
+	  memory available for the system above limit declared at system startup.
+	  It is very useful on critical systems which require long run without
+	  rebooting.
+
 config XEN_SCRUB_PAGES
 	bool "Scrub pages before returning them to system"
 	depends on XEN_BALLOON
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 06dbdad..69d9367 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -6,6 +6,7 @@
  * Copyright (c) 2003, B Dragovic
  * Copyright (c) 2003-2004, M Williamson, K Fraser
  * Copyright (c) 2005 Dan M. Smith, IBM Corporation
+ * Copyright (c) 2010 Daniel Kiper
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 2
@@ -44,6 +45,7 @@
 #include <linux/list.h>
 #include <linux/sysdev.h>
 #include <linux/gfp.h>
+#include <linux/memory.h>
 
 #include <asm/page.h>
 #include ...
From: Konrad Rzeszutek Wilk
Date: Monday, December 27, 2010 - 8:25 am

Could we just stop here instead of bugging out? I mean we adding memory so


I think you are going to hit a memory leak. If we fail, you do not


--

From: Daniel Kiper
Date: Wednesday, December 29, 2010 - 9:42 am

Hi,


If release_resource()/adjust_resource() fail it means
there is no possibility to align resource descpription with
real memory address space. I think it is fatal error. If
we decide to leave system in that state it could lead

Very good question. I based that fragment of code on original
increase_reservation()/decrease_reservation(). I attempted to find
any good explanation for that however, without success. That is why
I decided to not touch that fragment of code. If I had any

Yes, request_additional_memory() allocate memory in chunks
and r is used between subsequent calls until all memory

If balloon_stats.mh_policy == MH_POLICY_TRY_UNTIL_SUCCESS then
balloon process attempt to allocate requested memory until success.



Daniel
--

Previous thread: [PATCH 2/3] drivers/xen/balloon.c: Various balloon features and fixes by Daniel Kiper on Monday, December 20, 2010 - 6:47 am. (11 messages)

Next thread: [PATCH 1/3] mm: Add add_registered_memory() to memory hotplug API by Daniel Kiper on Monday, December 20, 2010 - 6:46 am. (1 message)