netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vhost: get 2% performance improved by reducing spin_lock race in vhost_work_queue
@ 2013-05-20  3:06 Qinchuanyu
  2013-05-20  3:38 ` Jason Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Qinchuanyu @ 2013-05-20  3:06 UTC (permalink / raw)
  To: rusty@rustcorp.com.au, mst@redhat.com, dhowells@redhat.com,
	jasowang@redhat.com
  Cc:  (kvm@vger.kernel.org),  (netdev@vger.kernel.org)

Right now the wake_up_process func is included in spin_lock/unlock, but it could be done outside the spin_lock.
I have test it with kernel 3.0.27 and guest suse11-sp2, it provide 2%-3% net performance improved.

Signed-off-by: Chuanyu Qin <qinchuanyu@huawei.com>
--- a/drivers/vhost/vhost.c     2013-05-20 10:36:30.000000000 +0800
+++ b/drivers/vhost/vhost.c     2013-05-20 10:36:54.000000000 +0800
@@ -144,9 +144,10 @@
        if (list_empty(&work->node)) {
                list_add_tail(&work->node, &dev->work_list);
                work->queue_seq++;
+               spin_unlock_irqrestore(&dev->work_lock, flags);
                wake_up_process(dev->worker);
-       }
-       spin_unlock_irqrestore(&dev->work_lock, flags);
+       } else
+               spin_unlock_irqrestore(&dev->work_lock, flags);
 }
 
 void vhost_poll_queue(struct vhost_poll *poll)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-21  2:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20  3:06 [PATCH] vhost: get 2% performance improved by reducing spin_lock race in vhost_work_queue Qinchuanyu
2013-05-20  3:38 ` Jason Wang
2013-05-20  4:15   ` Lei Li
2013-05-20  4:22   ` Qinchuanyu
2013-05-20  4:46     ` Jason Wang
2013-05-21  2:40       ` Qinchuanyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).