From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Wang Subject: Re: [PATCH 1/1] vhost: add per-vq worker thread Date: Mon, 5 Nov 2018 10:53:42 +0800 Message-ID: References: <20181102160710.3741-1-v.mayatskih@gmail.com> <20181102160710.3741-2-v.mayatskih@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: Vitaly Mayatskikh , "Michael S . Tsirkin" Return-path: In-Reply-To: <20181102160710.3741-2-v.mayatskih@gmail.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 2018/11/3 上午12:07, Vitaly Mayatskikh wrote: > + > +static int vhost_vq_poll_start(struct vhost_virtqueue *vq) > +{ > + if (!vq->worker) { > + vq->worker = kthread_create(vhost_vq_worker, vq, "vhost-%d/%i", > + vq->dev->pid, vq->index); > + if (IS_ERR(vq->worker)) { > + int ret = PTR_ERR(vq->worker); > + > + pr_err("%s: can't create vq worker: %d\n", __func__, > + ret); > + vq->worker = NULL; > + return ret; > + } > + } > + vhost_work_init(&vq->work, vhost_vq_poll_start_work); > + vhost_vq_work_queue(vq, &vq->work); > + return 0; > +} > + I wonder whether or not it's better to allow the device to specific the worker here instead of forcing a per vq worker model. Then we can keep the behavior of exist implementation and do optimization on top? Thanks