aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@vmware.com>2011-07-26 19:08:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 19:49:45 -0400
commitbeda94da38d2a3bf7f40c01f0a8e6d86067c91cc (patch)
tree8ba71064abc8d9ee10370ac40d66a1189dba1423 /drivers
parentf7b1371eb6b3ff72e38de220663b22f7cc9df296 (diff)
Vmware balloon: switch to using sysem-wide freezable workqueue
With the arrival of concurrency-managed workqueues there is no need for our driver to use dedicated workqueue; system-wide one should suffice just fine. [akpm@linux-foundation.org: fix comment layout & grammar] Signed-off-by: Dmitry Torokhov <dtor@vmware.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/vmw_balloon.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 6df5a55da110..053d36caf955 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -45,7 +45,7 @@
45 45
46MODULE_AUTHOR("VMware, Inc."); 46MODULE_AUTHOR("VMware, Inc.");
47MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver"); 47MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver");
48MODULE_VERSION("1.2.1.2-k"); 48MODULE_VERSION("1.2.1.3-k");
49MODULE_ALIAS("dmi:*:svnVMware*:*"); 49MODULE_ALIAS("dmi:*:svnVMware*:*");
50MODULE_ALIAS("vmware_vmmemctl"); 50MODULE_ALIAS("vmware_vmmemctl");
51MODULE_LICENSE("GPL"); 51MODULE_LICENSE("GPL");
@@ -215,7 +215,6 @@ struct vmballoon {
215}; 215};
216 216
217static struct vmballoon balloon; 217static struct vmballoon balloon;
218static struct workqueue_struct *vmballoon_wq;
219 218
220/* 219/*
221 * Send "start" command to the host, communicating supported version 220 * Send "start" command to the host, communicating supported version
@@ -674,7 +673,12 @@ static void vmballoon_work(struct work_struct *work)
674 vmballoon_deflate(b); 673 vmballoon_deflate(b);
675 } 674 }
676 675
677 queue_delayed_work(vmballoon_wq, dwork, round_jiffies_relative(HZ)); 676 /*
677 * We are using a freezable workqueue so that balloon operations are
678 * stopped while the system transitions to/from sleep/hibernation.
679 */
680 queue_delayed_work(system_freezable_wq,
681 dwork, round_jiffies_relative(HZ));
678} 682}
679 683
680/* 684/*
@@ -785,12 +789,6 @@ static int __init vmballoon_init(void)
785 if (x86_hyper != &x86_hyper_vmware) 789 if (x86_hyper != &x86_hyper_vmware)
786 return -ENODEV; 790 return -ENODEV;
787 791
788 vmballoon_wq = create_freezable_workqueue("vmmemctl");
789 if (!vmballoon_wq) {
790 pr_err("failed to create workqueue\n");
791 return -ENOMEM;
792 }
793
794 INIT_LIST_HEAD(&balloon.pages); 792 INIT_LIST_HEAD(&balloon.pages);
795 INIT_LIST_HEAD(&balloon.refused_pages); 793 INIT_LIST_HEAD(&balloon.refused_pages);
796 794
@@ -805,34 +803,27 @@ static int __init vmballoon_init(void)
805 */ 803 */
806 if (!vmballoon_send_start(&balloon)) { 804 if (!vmballoon_send_start(&balloon)) {
807 pr_err("failed to send start command to the host\n"); 805 pr_err("failed to send start command to the host\n");
808 error = -EIO; 806 return -EIO;
809 goto fail;
810 } 807 }
811 808
812 if (!vmballoon_send_guest_id(&balloon)) { 809 if (!vmballoon_send_guest_id(&balloon)) {
813 pr_err("failed to send guest ID to the host\n"); 810 pr_err("failed to send guest ID to the host\n");
814 error = -EIO; 811 return -EIO;
815 goto fail;
816 } 812 }
817 813
818 error = vmballoon_debugfs_init(&balloon); 814 error = vmballoon_debugfs_init(&balloon);
819 if (error) 815 if (error)
820 goto fail; 816 return error;
821 817
822 queue_delayed_work(vmballoon_wq, &balloon.dwork, 0); 818 queue_delayed_work(system_freezable_wq, &balloon.dwork, 0);
823 819
824 return 0; 820 return 0;
825
826fail:
827 destroy_workqueue(vmballoon_wq);
828 return error;
829} 821}
830module_init(vmballoon_init); 822module_init(vmballoon_init);
831 823
832static void __exit vmballoon_exit(void) 824static void __exit vmballoon_exit(void)
833{ 825{
834 cancel_delayed_work_sync(&balloon.dwork); 826 cancel_delayed_work_sync(&balloon.dwork);
835 destroy_workqueue(vmballoon_wq);
836 827
837 vmballoon_debugfs_exit(&balloon); 828 vmballoon_debugfs_exit(&balloon);
838 829