vhost: replace vhost_workqueue with per-vhost kthread
authorTejun Heo <tj@kernel.org>
Wed, 2 Jun 2010 18:40:00 +0000 (20:40 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 28 Jul 2010 12:44:53 +0000 (15:44 +0300)
commitc23f3445e68e1db0e74099f264bc5ff5d55ebdeb
tree0a8e22e9a10c2978777954a022d721eb02e622be
parent4cfa580e7eebb8694b875d2caff3b989ada2efac
vhost: replace vhost_workqueue with per-vhost kthread

Replace vhost_workqueue with per-vhost kthread.  Other than callback
argument change from struct work_struct * to struct vhost_work *,
there's no visible change to vhost_poll_*() interface.

This conversion is to make each vhost use a dedicated kthread so that
resource control via cgroup can be applied.

Partially based on Sridhar Samudrala's patch.

* Updated to use sub structure vhost_work instead of directly using
  vhost_poll at Michael's suggestion.

* Added flusher wake_up() optimization at Michael's suggestion.

Changes by MST:
* Converted atomics/barrier use to a spinlock.
* Create thread on SET_OWNER
* Fix flushing

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Sridhar Samudrala <samudrala.sridhar@gmail.com>
drivers/vhost/net.c
drivers/vhost/vhost.c
drivers/vhost/vhost.h