diff options
author | Mike Christie <michael.christie@oracle.com> | 2023-03-11 01:03:32 +0300 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-03-23 14:45:37 +0300 |
commit | 6e890c5d5021ca7e69bbe203fde42447874d9a82 (patch) | |
tree | 1c244655a6ce71005156847d8e8403d4034af4ea /drivers/vhost/vhost.h | |
parent | 1a5f8090c6de99306f4212dc7adfc6189a616eb9 (diff) | |
download | linux-6e890c5d5021ca7e69bbe203fde42447874d9a82.tar.xz |
vhost: use vhost_tasks for worker threads
For vhost workers we use the kthread API which inherit's its values from
and checks against the kthreadd thread. This results in the wrong RLIMITs
being checked, so while tools like libvirt try to control the number of
threads based on the nproc rlimit setting we can end up creating more
threads than the user wanted.
This patch has us use the vhost_task helpers which will inherit its
values/checks from the thread that owns the device similar to if we did
a clone in userspace. The vhost threads will now be counted in the nproc
rlimits. And we get features like cgroups and mm sharing automatically,
so we can remove those calls.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'drivers/vhost/vhost.h')
-rw-r--r-- | drivers/vhost/vhost.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 67d614b5453d..0308638cdeee 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -16,6 +16,7 @@ #include <linux/irqbypass.h> struct vhost_work; +struct vhost_task; typedef void (*vhost_work_fn_t)(struct vhost_work *work); #define VHOST_WORK_QUEUED 1 @@ -26,9 +27,8 @@ struct vhost_work { }; struct vhost_worker { - struct task_struct *task; + struct vhost_task *vtsk; struct llist_head work_list; - struct vhost_dev *dev; u64 kcov_handle; }; |