From: "Michael S. Tsirkin" <mst@redhat.com>
To: Yin Xiujiang <yinxiujiang@kylinos.cn>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] vhost: Make use of the helper macro kthread_run()
Date: Thu, 27 Jan 2022 07:41:44 -0500 [thread overview]
Message-ID: <20220127074050-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220127020807.844630-1-yinxiujiang@kylinos.cn>
On Thu, Jan 27, 2022 at 10:08:07AM +0800, Yin Xiujiang wrote:
> Repalce kthread_create/wake_up_process() with kthread_run()
> to simplify the code.
>
> Signed-off-by: Yin Xiujiang <yinxiujiang@kylinos.cn>
> ---
> drivers/vhost/vhost.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 59edb5a1ffe2..19e9eda9fc71 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -595,7 +595,7 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
>
> dev->kcov_handle = kcov_common_handle();
> if (dev->use_worker) {
> - worker = kthread_create(vhost_worker, dev,
> + worker = kthread_run(vhost_worker, dev,
> "vhost-%d", current->pid);
> if (IS_ERR(worker)) {
> err = PTR_ERR(worker);
> @@ -603,7 +603,6 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
> }
>
> dev->worker = worker;
> - wake_up_process(worker); /* avoid contributing to loadavg */
>
> err = vhost_attach_cgroups(dev);
> if (err)
I think if you do this, you need to set dev->worker earlier.
> --
> 2.30.0
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Yin Xiujiang <yinxiujiang@kylinos.cn>
Cc: jasowang@redhat.com, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vhost: Make use of the helper macro kthread_run()
Date: Thu, 27 Jan 2022 07:41:44 -0500 [thread overview]
Message-ID: <20220127074050-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220127020807.844630-1-yinxiujiang@kylinos.cn>
On Thu, Jan 27, 2022 at 10:08:07AM +0800, Yin Xiujiang wrote:
> Repalce kthread_create/wake_up_process() with kthread_run()
> to simplify the code.
>
> Signed-off-by: Yin Xiujiang <yinxiujiang@kylinos.cn>
> ---
> drivers/vhost/vhost.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 59edb5a1ffe2..19e9eda9fc71 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -595,7 +595,7 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
>
> dev->kcov_handle = kcov_common_handle();
> if (dev->use_worker) {
> - worker = kthread_create(vhost_worker, dev,
> + worker = kthread_run(vhost_worker, dev,
> "vhost-%d", current->pid);
> if (IS_ERR(worker)) {
> err = PTR_ERR(worker);
> @@ -603,7 +603,6 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
> }
>
> dev->worker = worker;
> - wake_up_process(worker); /* avoid contributing to loadavg */
>
> err = vhost_attach_cgroups(dev);
> if (err)
I think if you do this, you need to set dev->worker earlier.
> --
> 2.30.0
next prev parent reply other threads:[~2022-01-27 12:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 2:08 [PATCH] vhost: Make use of the helper macro kthread_run() Yin Xiujiang
2022-01-27 8:31 ` Jason Wang
2022-01-27 8:31 ` Jason Wang
2022-01-27 12:41 ` Michael S. Tsirkin [this message]
2022-01-27 12:41 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2021-10-21 8:44 Cai Huoqing
2021-10-21 8:44 ` Cai Huoqing
2021-10-27 20:02 ` Michael S. Tsirkin
2021-10-27 20:02 ` Michael S. Tsirkin
2021-10-27 20:12 ` Mike Christie
2021-10-27 20:12 ` Mike Christie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220127074050-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=yinxiujiang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.