aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-07-27 15:56:50 -0400
committerMichael S. Tsirkin <mst@redhat.com>2010-07-28 08:45:18 -0400
commit9e3d195720d1c8b1e09013185ab8c3b749180fc2 (patch)
tree365fad241060b88546d7d5523e9c5a74c968a56c
parentd7926ee38f5c6e0bbebe712304f99a4c67e40f84 (diff)
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>
-rw-r--r--drivers/vhost/vhost.c6
1 files changed, 6 insertions, 0 deletions
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 @@
23#include <linux/highmem.h> 23#include <linux/highmem.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kthread.h> 25#include <linux/kthread.h>
26#include <linux/cgroup.h>
26 27
27#include <linux/net.h> 28#include <linux/net.h>
28#include <linux/if_packet.h> 29#include <linux/if_packet.h>
@@ -253,9 +254,14 @@ static long vhost_dev_set_owner(struct vhost_dev *dev)
253 } 254 }
254 255
255 dev->worker = worker; 256 dev->worker = worker;
257 err = cgroup_attach_task_current_cg(worker);
258 if (err)
259 goto err_cgroup;
256 wake_up_process(worker); /* avoid contributing to loadavg */ 260 wake_up_process(worker); /* avoid contributing to loadavg */
257 261
258 return 0; 262 return 0;
263err_cgroup:
264 kthread_stop(worker);
259err_worker: 265err_worker:
260 if (dev->mm) 266 if (dev->mm)
261 mmput(dev->mm); 267 mmput(dev->mm);