From: Michael S. Tsirkin Date: Tue, 27 Jul 2010 19:56:50 +0000 (+0300) Subject: vhost: apply cgroup to vhost workers X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9e3d195720d1c8b1e09013185ab8c3b749180fc2;p=linux-beck.git 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 Cc: Tejun Heo Cc: Sridhar Samudrala Cc: Li Zefan --- diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 30d93c2b45b8..dd2d019b889f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -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);