diff options
-rw-r--r-- | drivers/xen/balloon.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 42a0ba0e71b..a6d8e59e453 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -193,7 +193,7 @@ static enum bp_state update_schedule(enum bp_state state) | |||
193 | return BP_EAGAIN; | 193 | return BP_EAGAIN; |
194 | } | 194 | } |
195 | 195 | ||
196 | static unsigned long current_target(void) | 196 | static long current_credit(void) |
197 | { | 197 | { |
198 | unsigned long target = balloon_stats.target_pages; | 198 | unsigned long target = balloon_stats.target_pages; |
199 | 199 | ||
@@ -202,7 +202,7 @@ static unsigned long current_target(void) | |||
202 | balloon_stats.balloon_low + | 202 | balloon_stats.balloon_low + |
203 | balloon_stats.balloon_high); | 203 | balloon_stats.balloon_high); |
204 | 204 | ||
205 | return target; | 205 | return target - balloon_stats.current_pages; |
206 | } | 206 | } |
207 | 207 | ||
208 | static enum bp_state increase_reservation(unsigned long nr_pages) | 208 | static enum bp_state increase_reservation(unsigned long nr_pages) |
@@ -337,7 +337,7 @@ static void balloon_process(struct work_struct *work) | |||
337 | mutex_lock(&balloon_mutex); | 337 | mutex_lock(&balloon_mutex); |
338 | 338 | ||
339 | do { | 339 | do { |
340 | credit = current_target() - balloon_stats.current_pages; | 340 | credit = current_credit(); |
341 | 341 | ||
342 | if (credit > 0) | 342 | if (credit > 0) |
343 | state = increase_reservation(credit); | 343 | state = increase_reservation(credit); |
@@ -420,7 +420,7 @@ void free_xenballooned_pages(int nr_pages, struct page** pages) | |||
420 | } | 420 | } |
421 | 421 | ||
422 | /* The balloon may be too large now. Shrink it if needed. */ | 422 | /* The balloon may be too large now. Shrink it if needed. */ |
423 | if (current_target() != balloon_stats.current_pages) | 423 | if (current_credit()) |
424 | schedule_delayed_work(&balloon_worker, 0); | 424 | schedule_delayed_work(&balloon_worker, 0); |
425 | 425 | ||
426 | mutex_unlock(&balloon_mutex); | 426 | mutex_unlock(&balloon_mutex); |