On Tue, Nov 23, 2010 at 10:13:43AM +0800, lidong chen wrote: > I test the performance between per-vhost kthread disable and enable. > > Test method: > Send the same traffic load between per-vhost kthread disable and > enable, and compare the cpu rate of host os. > I run five vm on kvm, each of them have five nic. > the vhost version which per-vhost kthread disable we used is rhel6 > beta 2(2.6.32.60). > the vhost version which per-vhost kthread enable we used is rhel6 (2.6.32-71). > > Test result: > with per-vhost kthread disable, the cpu rate of host os is 110%. > with per-vhost kthread enable, the cpu rate of host os is 130%.
Does it help if we schedule out the thread once we've passed once over all vqs? Something like this: diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 1b0a20d..256e915 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -175,6 +175,7 @@ static int vhost_worker(void *data) struct vhost_dev *dev = data; struct vhost_work *work = NULL; unsigned uninitialized_var(seq); + int n = 0; use_mm(dev->mm); @@ -206,9 +207,11 @@ static int vhost_worker(void *data) if (work) { __set_current_state(TASK_RUNNING); work->fn(work); - } else - schedule(); - + if (likely(++n < dev->nvqs)) + continue; + } + schedule(); + n = 0; } unuse_mm(dev->mm); return 0; -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html