makes it possible to batch use/unuse mm Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx> --- drivers/vhost/vhost.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 677d112..8b9d474 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -207,7 +207,7 @@ static int vhost_worker(void *data) if (work) { __set_current_state(TASK_RUNNING); work->fn(work); - if (n++) { + if (dev->nvqs <= ++n) { __set_current_state(TASK_RUNNING); schedule(); n = 0; @@ -409,15 +409,14 @@ void vhost_dev_cleanup(struct vhost_dev *dev) /* No one will access memory at this point */ kfree(dev->memory); dev->memory = NULL; - if (dev->mm) - mmput(dev->mm); - dev->mm = NULL; - WARN_ON(!list_empty(&dev->work_list)); if (dev->worker) { kthread_stop(dev->worker); dev->worker = NULL; } + if (dev->mm) + mmput(dev->mm); + dev->mm = NULL; } static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz) -- 1.7.3-rc1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html