linux_old1/drivers/vhost
Nadav Har'El d550dda192 vhost: don't forget to schedule()
This is a tiny, but important, patch to vhost.

Vhost's worker thread only called schedule() when it had no work to do, and
it wanted to go to sleep. But if there's always work to do, e.g., the guest
is running a network-intensive program like netperf with small message sizes,
schedule() was *never* called. This had several negative implications (on
non-preemptive kernels):

 1. Passing time was not properly accounted to the "vhost" process (ps and
    top would wrongly show it using zero CPU time).

 2. Sometimes error messages about RCU timeouts would be printed, if the
    core running the vhost thread didn't schedule() for a very long time.

 3. Worst of all, a vhost thread would "hog" the core. If several vhost
    threads need to share the same core, typically one would get most of the
    CPU time (and its associated guest most of the performance), while the
    others hardly get any work done.

The trivial solution is to add

	if (need_resched())
		schedule();

After doing every piece of work. This will not do the heavy schedule() all
the time, just when the timer interrupt decided a reschedule is warranted
(so need_resched returns true).

Thanks to Abel Gordon for this patch.

Signed-off-by: Nadav Har'El <nyh@il.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-02-28 09:13:19 +02:00
..
Kconfig net/macvtap: add vhost support 2010-02-18 14:08:38 -08:00
Makefile
net.c vhost-net: add module alias (v2.1) 2012-01-13 10:12:23 -08:00
test.c vhost: init used ring after backend was set 2011-07-19 13:28:34 +03:00
test.h vhost test module 2010-12-09 16:00:21 +02:00
vhost.c vhost: don't forget to schedule() 2012-02-28 09:13:19 +02:00
vhost.h atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00