diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-07-27 22:56:50 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-07-28 15:45:18 +0300 |
commit | 9e3d195720d1c8b1e09013185ab8c3b749180fc2 (patch) | |
tree | 365fad241060b88546d7d5523e9c5a74c968a56c /drivers/vhost | |
parent | d7926ee38f5c6e0bbebe712304f99a4c67e40f84 (diff) | |
download | kernel_samsung_smdk4412-9e3d195720d1c8b1e09013185ab8c3b749180fc2.zip kernel_samsung_smdk4412-9e3d195720d1c8b1e09013185ab8c3b749180fc2.tar.gz kernel_samsung_smdk4412-9e3d195720d1c8b1e09013185ab8c3b749180fc2.tar.bz2 |
vhost: apply cgroup to vhost workers
Apply the cgroup of the owner task to the created vhost worker.
Based on patches from Sridhar Samudrala's and Tejun Heo.
Later we'll need to also apply cpumask and probably priority
of the owner process.
Discussion on the best way to do this is still ongoing.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Sridhar Samudrala <samudrala.sridhar@gmail.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vhost.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 30d93c2..dd2d019 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -23,6 +23,7 @@ #include <linux/highmem.h> #include <linux/slab.h> #include <linux/kthread.h> +#include <linux/cgroup.h> #include <linux/net.h> #include <linux/if_packet.h> @@ -253,9 +254,14 @@ static long vhost_dev_set_owner(struct vhost_dev *dev) } dev->worker = worker; + err = cgroup_attach_task_current_cg(worker); + if (err) + goto err_cgroup; wake_up_process(worker); /* avoid contributing to loadavg */ return 0; +err_cgroup: + kthread_stop(worker); err_worker: if (dev->mm) mmput(dev->mm); |