lkml.org 
[lkml]   [2015]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCHv1 6/8] xen/balloon: only hotplug additional memory if required
Date
Now that we track the total number of pages (included hotplugged
regions), it is easy to determine if more memory needs to be
hotplugged.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
drivers/xen/balloon.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 960ac79..dd41da8 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -241,12 +241,22 @@ static void release_memory_resource(struct resource *resource)
* bit set). Real size of added memory is established at page onlining stage.
*/

-static enum bp_state reserve_additional_memory(long credit)
+static enum bp_state reserve_additional_memory(void)
{
+ long credit;
struct resource *resource;
int nid, rc;
unsigned long balloon_hotplug;

+ credit = balloon_stats.target_pages - balloon_stats.total_pages;
+
+ /*
+ * Already hotplugged enough pages? Wait for them to be
+ * onlined.
+ */
+ if (credit <= 0)
+ return BP_EAGAIN;
+
balloon_hotplug = round_up(credit, PAGES_PER_SECTION);

resource = additional_memory_resource(balloon_hotplug * PAGE_SIZE);
@@ -316,7 +326,7 @@ static struct notifier_block xen_memory_nb = {
.priority = 0
};
#else
-static enum bp_state reserve_additional_memory(long credit)
+static enum bp_state reserve_additional_memory(void)
{
balloon_stats.target_pages = balloon_stats.current_pages;
return BP_DONE;
@@ -483,7 +493,7 @@ static void balloon_process(struct work_struct *work)
if (balloon_is_inflated())
state = increase_reservation(credit);
else
- state = reserve_additional_memory(credit);
+ state = reserve_additional_memory();
}

if (credit < 0)
--
1.7.10.4


\
 
 \ /
  Last update: 2015-06-25 19:21    [W:0.239 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site