]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kvm tools: Process virito blk requests in separate thread
authorAsias He <asias.hejun@gmail.com>
Tue, 29 Nov 2011 13:55:20 +0000 (21:55 +0800)
committerPekka Enberg <penberg@kernel.org>
Tue, 12 Jun 2012 09:31:23 +0000 (12:31 +0300)
commit55b5e71ffee7b1b3475fa01009c7893fa0b6a4ac
treeea29405a4b08568ece2ab9941136ebda80f6480f
parentb9137f616884386484319f33cd6bec2839486233
kvm tools: Process virito blk requests in separate thread

All blk requests are processed in notify_vq() which is in the context of
ioeventfd thread: ioeventfd__thread(). The processing in notify_vq() may
take a long time to complete and all devices share the single ioeventfd
thead, so this might block other device's notify_vq() being called and
starve other devices.

This patch makes virtio blk's notify_vq() just notify the blk thread
instead of doing the real hard read/write work. Tests show that the
overhead of the notification operations is small.

The reasons for using dedicated thead instead of using thead pool
follow:

1) In thread pool model, each job handling operation:
thread_pool__do_job() takes about 6 or 7 mutex_{lock,unlock} ops. Most
of the mutex are global (job_mutex) which are contented by the threads
in the pool. It's fine for the non performance critical virtio devices,
such as console, rng, etc. But it's not optimal for net and blk devices.

2) Using dedicated threads to handle blk requests opens the door for
user to set different IO priority for the blk threads.

3) It also reduces the contentions between net and blk devices if they
do not share the thead pool.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/virtio/blk.c