aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Kiper <dkiper@net-space.pl>2011-03-08 16:47:39 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-03-14 11:34:20 -0400
commit95170b2e23d4e98843b4833d27fae7bf0910e19c (patch)
treea9b76ba407c43b923a757ec2c85004bbd5e066b7 /drivers
parent06f521d5d67a23d91add6f1beb73edc6f2b70d0c (diff)
xen/balloon: Migration from mod_timer() to schedule_delayed_work()
Migration from mod_timer() to schedule_delayed_work(). 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.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index b4206fd6b1b9..9206ff7514e7 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -99,8 +99,7 @@ static LIST_HEAD(ballooned_pages);
99 99
100/* Main work function, always executed in process context. */ 100/* Main work function, always executed in process context. */
101static void balloon_process(struct work_struct *work); 101static void balloon_process(struct work_struct *work);
102static DECLARE_WORK(balloon_worker, balloon_process); 102static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
103static struct timer_list balloon_timer;
104 103
105/* When ballooning out (allocating memory to return to Xen) we don't really 104/* When ballooning out (allocating memory to return to Xen) we don't really
106 want the kernel to try too hard since that can trigger the oom killer. */ 105 want the kernel to try too hard since that can trigger the oom killer. */
@@ -172,11 +171,6 @@ static struct page *balloon_next_page(struct page *page)
172 return list_entry(next, struct page, lru); 171 return list_entry(next, struct page, lru);
173} 172}
174 173
175static void balloon_alarm(unsigned long unused)
176{
177 schedule_work(&balloon_worker);
178}
179
180static unsigned long current_target(void) 174static unsigned long current_target(void)
181{ 175{
182 unsigned long target = balloon_stats.target_pages; 176 unsigned long target = balloon_stats.target_pages;
@@ -333,7 +327,7 @@ static void balloon_process(struct work_struct *work)
333 327
334 /* Schedule more work if there is some still to be done. */ 328 /* Schedule more work if there is some still to be done. */
335 if (current_target() != balloon_stats.current_pages) 329 if (current_target() != balloon_stats.current_pages)
336 mod_timer(&balloon_timer, jiffies + HZ); 330 schedule_delayed_work(&balloon_worker, HZ);
337 331
338 mutex_unlock(&balloon_mutex); 332 mutex_unlock(&balloon_mutex);
339} 333}
@@ -343,7 +337,7 @@ static void balloon_set_new_target(unsigned long target)
343{ 337{
344 /* No need for lock. Not read-modify-write updates. */ 338 /* No need for lock. Not read-modify-write updates. */
345 balloon_stats.target_pages = target; 339 balloon_stats.target_pages = target;
346 schedule_work(&balloon_worker); 340 schedule_delayed_work(&balloon_worker, 0);
347} 341}
348 342
349static struct xenbus_watch target_watch = 343static struct xenbus_watch target_watch =
@@ -400,10 +394,6 @@ static int __init balloon_init(void)
400 balloon_stats.balloon_low = 0; 394 balloon_stats.balloon_low = 0;
401 balloon_stats.balloon_high = 0; 395 balloon_stats.balloon_high = 0;
402 396
403 init_timer(&balloon_timer);
404 balloon_timer.data = 0;
405 balloon_timer.function = balloon_alarm;
406
407 register_balloon(&balloon_sysdev); 397 register_balloon(&balloon_sysdev);
408 398
409 /* 399 /*