linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH R2 4/7] xen/balloon: migration from mod_timer() to schedule_delayed_work()
@ 2010-12-29 17:04 Daniel Kiper
  0 siblings, 0 replies; only message in thread
From: Daniel Kiper @ 2010-12-29 17:04 UTC (permalink / raw)
  To: ian.campbell, akpm, andi.kleen, haicheng.li, fengguang.wu,
	jeremy, konrad.wilk, dan.magenheimer, v.tolstov, xen-devel,
	linux-kernel, linux-mm

migration from mod_timer() to schedule_delayed_work().

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
---
 drivers/xen/balloon.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 878f54c..11143af 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -98,8 +98,7 @@ static LIST_HEAD(ballooned_pages);
 
 /* Main work function, always executed in process context. */
 static void balloon_process(struct work_struct *work);
-static DECLARE_WORK(balloon_worker, balloon_process);
-static struct timer_list balloon_timer;
+static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
 
 /* When ballooning out (allocating memory to return to Xen) we don't really
    want the kernel to try too hard since that can trigger the oom killer. */
@@ -167,11 +166,6 @@ static struct page *balloon_next_page(struct page *page)
 	return list_entry(next, struct page, lru);
 }
 
-static void balloon_alarm(unsigned long unused)
-{
-	schedule_work(&balloon_worker);
-}
-
 static unsigned long current_target(void)
 {
 	unsigned long target = balloon_stats.target_pages;
@@ -336,7 +330,7 @@ static void balloon_process(struct work_struct *work)
 
 	/* Schedule more work if there is some still to be done. */
 	if (current_target() != balloon_stats.current_pages)
-		mod_timer(&balloon_timer, jiffies + HZ);
+		schedule_delayed_work(&balloon_worker, HZ);
 
 	mutex_unlock(&balloon_mutex);
 }
@@ -346,7 +340,7 @@ static void balloon_set_new_target(unsigned long target)
 {
 	/* No need for lock. Not read-modify-write updates. */
 	balloon_stats.target_pages = target;
-	schedule_work(&balloon_worker);
+	schedule_delayed_work(&balloon_worker, 0);
 }
 
 static struct xenbus_watch target_watch =
@@ -405,10 +399,6 @@ static int __init balloon_init(void)
 	balloon_stats.balloon_low   = 0;
 	balloon_stats.balloon_high  = 0;
 
-	init_timer(&balloon_timer);
-	balloon_timer.data = 0;
-	balloon_timer.function = balloon_alarm;
-
 	register_balloon(&balloon_sysdev);
 
 	/* Initialise the balloon with excess memory space. */
-- 
1.4.4.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-29 17:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-29 17:04 [PATCH R2 4/7] xen/balloon: migration from mod_timer() to schedule_delayed_work() Daniel Kiper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox