Re: [PATCH v2 6/7] vhost: Add kthread support in function vhost_worker_create
From: Cindy Lu
Date: Tue Oct 15 2024 - 02:31:20 EST
On Tue, 15 Oct 2024 at 05:02, Mike Christie <michael.christie@xxxxxxxxxx> wrote:
>
> On 10/3/24 8:58 PM, Cindy Lu wrote:
> > +static struct vhost_worker *vhost_worker_create(struct vhost_dev *dev)
> > +{
> > + if (enforce_inherit_owner)
> > + return vhost_worker_create_task(dev);
> > + else
> > + return vhost_worker_create_kthread(dev);
> > +}
>
> The reason we are in this whole mess is because for vhost-scsi
> we wanted to create multiple worker threads as the single thread
> became a bottleneck. We couldn't use kthreads because they were
> not accounted for under thread that created it and we could
> exceed the NPROC_LIMIT.
>
> So with the above code, we could hit that problem again if userspace
> did the VHOST_NEW_WORKER ioctl and enforce_inherit_owner=false.
>
> You would want a check for enforce_inherit_owner in vhost_worker_ioctl.
>
sure, will add this check
Thanks
cindy