All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: lidong chen <chen.lidong.kernel@gmail.com>
Cc: tj@kernel.org, sri@us.ibm.com, Avi Kivity <avi@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: Performance test result between per-vhost kthread disable and enable
Date: Thu, 9 Dec 2010 15:31:09 +0200	[thread overview]
Message-ID: <20101209133108.GB22460@redhat.com> (raw)
In-Reply-To: <AANLkTincHcO-vmPFLm+0zGhKaqz59VAFtk_M-Fu+-DZX@mail.gmail.com>

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;

  parent reply	other threads:[~2010-12-09 13:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23  2:13 Performance test result between per-vhost kthread disable and enable lidong chen
2010-11-23  6:29 ` Huang, Zhiteng
2010-11-23  6:52   ` lidong chen
2010-11-23  6:54     ` Huang, Zhiteng
2010-11-23  7:09       ` lidong chen
2010-11-23 11:12 ` Michael S. Tsirkin
2010-11-23 13:23   ` lidong chen
2010-11-23 13:41     ` Michael S. Tsirkin
2010-11-23 16:00       ` Sridhar Samudrala
2010-11-24  6:49         ` lidong chen
2010-11-24 10:46           ` Michael S. Tsirkin
2010-11-24 16:31             ` lidong chen
2010-12-09 13:31 ` Michael S. Tsirkin [this message]
2010-12-09 13:34   ` Michael S. Tsirkin

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=20101209133108.GB22460@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=chen.lidong.kernel@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=sri@us.ibm.com \
    --cc=tj@kernel.org \
    /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.