diff options
author | Alexander Motin <mav@FreeBSD.org> | 2011-05-13 03:40:16 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2011-05-13 03:40:16 +0000 |
commit | c4f9a105902e0e309eee2320ef637c3fbc114694 (patch) | |
tree | 7a610dceca94b17d7bf8ef151c77af4f0d0733e4 /sys | |
parent | 8fedd5eb65ec1941518d9db78b79a9661c626f92 (diff) | |
download | src-c4f9a105902e0e309eee2320ef637c3fbc114694.tar.gz src-c4f9a105902e0e309eee2320ef637c3fbc114694.zip |
Fix msleep() usage in Xen balloon driver to not wake up on every HZ tick.
Notes
Notes:
svn path=/head/; revision=221827
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/xen/balloon/balloon.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/dev/xen/balloon/balloon.c b/sys/dev/xen/balloon/balloon.c index dff80ba3e8f1..81d1094e180c 100644 --- a/sys/dev/xen/balloon/balloon.c +++ b/sys/dev/xen/balloon/balloon.c @@ -147,12 +147,6 @@ balloon_retrieve(void) return page; } -static void -balloon_alarm(void *unused) -{ - wakeup(balloon_process); -} - static unsigned long current_target(void) { @@ -378,6 +372,8 @@ balloon_process(void *unused) mtx_lock(&balloon_mutex); for (;;) { + int sleep_time; + do { credit = current_target() - bs.current_pages; if (credit > 0) @@ -389,9 +385,12 @@ balloon_process(void *unused) /* Schedule more work if there is some still to be done. */ if (current_target() != bs.current_pages) - timeout(balloon_alarm, NULL, ticks + hz); + sleep_time = hz; + else + sleep_time = 0; - msleep(balloon_process, &balloon_mutex, 0, "balloon", -1); + msleep(balloon_process, &balloon_mutex, 0, "balloon", + sleep_time); } mtx_unlock(&balloon_mutex); } @@ -474,9 +473,6 @@ balloon_init(void *arg) bs.hard_limit = ~0UL; kproc_create(balloon_process, NULL, NULL, 0, 0, "balloon"); -// init_timer(&balloon_timer); -// balloon_timer.data = 0; -// balloon_timer.function = balloon_alarm; #ifndef XENHVM /* Initialise the balloon with excess memory space. */ |