[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241105072642.898710-7-lulu@redhat.com>
Date: Tue, 5 Nov 2024 15:25:25 +0800
From: Cindy Lu <lulu@...hat.com>
To: lulu@...hat.com,
jasowang@...hat.com,
mst@...hat.com,
michael.christie@...cle.com,
sgarzare@...hat.com,
linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
netdev@...r.kernel.org
Subject: [PATCH v3 6/9] vhost: Add kthread support in function vhost_worker_destroy()
The function vhost_worker_destroy() will use struct vhost_task_fn and
selects the different mode based on the value of inherit_owner.
Signed-off-by: Cindy Lu <lulu@...hat.com>
---
drivers/vhost/vhost.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 8b7ddfb33c61..c17dc01febcc 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -718,12 +718,14 @@ static void vhost_detach_mm(struct vhost_dev *dev)
static void vhost_worker_destroy(struct vhost_dev *dev,
struct vhost_worker *worker)
{
- if (!worker)
+ if (!worker && !worker->fn)
return;
WARN_ON(!llist_empty(&worker->work_list));
xa_erase(&dev->worker_xa, worker->id);
- vhost_task_stop(worker->vtsk);
+ worker->fn->stop(dev->inherit_owner ? (void *)worker->vtsk :
+ (void *)worker->task);
+ kfree(worker->fn);
kfree(worker);
}
--
2.45.0
Powered by blists - more mailing lists