diff options
author | Daniel Kiper <dkiper@net-space.pl> | 2011-03-28 11:34:10 +0200 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-03-30 17:54:44 +0200 |
commit | 83be7e52d46a5b3a9955a38a9597bf1de1851ea7 (patch) | |
tree | 665164261531c284b5dc5922cd42bc503e1d40ff /drivers | |
parent | xen/balloon: Simplify HVM integration (diff) | |
download | linux-83be7e52d46a5b3a9955a38a9597bf1de1851ea7.tar.xz linux-83be7e52d46a5b3a9955a38a9597bf1de1851ea7.zip |
xen/balloon: Clarify credit calculation
Move credit calculation to current_target()
and rename it to current_credit().
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers')
-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 42a0ba0e71b8..a6d8e59e4531 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) return BP_EAGAIN; } -static unsigned long current_target(void) +static long current_credit(void) { unsigned long target = balloon_stats.target_pages; @@ -202,7 +202,7 @@ static unsigned long current_target(void) balloon_stats.balloon_low + balloon_stats.balloon_high); - return target; + return target - balloon_stats.current_pages; } static enum bp_state increase_reservation(unsigned long nr_pages) @@ -337,7 +337,7 @@ static void balloon_process(struct work_struct *work) mutex_lock(&balloon_mutex); do { - credit = current_target() - balloon_stats.current_pages; + credit = current_credit(); if (credit > 0) state = increase_reservation(credit); @@ -420,7 +420,7 @@ void free_xenballooned_pages(int nr_pages, struct page** pages) } /* The balloon may be too large now. Shrink it if needed. */ - if (current_target() != balloon_stats.current_pages) + if (current_credit()) schedule_delayed_work(&balloon_worker, 0); mutex_unlock(&balloon_mutex); |