From 9e3d195720d1c8b1e09013185ab8c3b749180fc2 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Tue, 27 Jul 2010 22:56:50 +0300 Subject: [PATCH] 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 --- drivers/vhost/vhost.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 30d93c2b45b..dd2d019b889 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); -- 2.43.2