X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=drivers%2Fxen%2Fballoon.c;h=9206ff7514e7b294e2e734a0d08496313136830d;hb=95170b2e23d4e98843b4833d27fae7bf0910e19c;hp=43f9f02c7db0671668343fc19bed043fbbe61fad;hpb=67290f41b2715de0e0ae93c9285fcbe37ffc5b22;p=~andy%2Flinux diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 43f9f02c7db..9206ff7514e 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -70,11 +70,6 @@ struct balloon_stats { /* We aim for 'current allocation' == 'target allocation'. */ unsigned long current_pages; unsigned long target_pages; - /* - * Drivers may alter the memory reservation independently, but they - * must inform the balloon driver so we avoid hitting the hard limit. - */ - unsigned long driver_pages; /* Number of pages in high- and low-memory balloons. */ unsigned long balloon_low; unsigned long balloon_high; @@ -104,8 +99,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. */ @@ -177,11 +171,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; @@ -338,7 +327,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); } @@ -348,7 +337,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 = @@ -404,11 +393,6 @@ static int __init balloon_init(void) balloon_stats.target_pages = balloon_stats.current_pages; balloon_stats.balloon_low = 0; balloon_stats.balloon_high = 0; - balloon_stats.driver_pages = 0UL; - - init_timer(&balloon_timer); - balloon_timer.data = 0; - balloon_timer.function = balloon_alarm; register_balloon(&balloon_sysdev); @@ -462,7 +446,6 @@ module_exit(balloon_exit); BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages)); BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low)); BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high)); -BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(balloon_stats.driver_pages)); static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) @@ -531,7 +514,6 @@ static struct attribute *balloon_info_attrs[] = { &attr_current_kb.attr, &attr_low_kb.attr, &attr_high_kb.attr, - &attr_driver_kb.attr, NULL };