Message ID | 20241105072642.898710-7-lulu@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | vhost: Add support of kthread API | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
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); }
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@redhat.com> --- drivers/vhost/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)