For batching, slower is better.

Interrupts and notifications cost enough that if we wait 50usec for
more outgoing packets, we really reduce the number of interrupts, and our
throughput doubles.

Our latency, of course, is wrecked.

Note that inside lguest, the 1Gping-throughput.sh on loopback takes 13
seconds, and the 1Mping takes 12.

Before:
	1Gping-throughput.sh: Seconds: 23
	1Gping-throughput.sh: Packets: 1000001,1000004
	1Gping-throughput.sh: Interrupts: 999906,1
	1Gping-throughput.sh: Notifications: 15385(0),999966(39)
	Net IRQs triggered: 999932(16),1(999918)
	1Mping.sh: Seconds: 24
	1Mping.sh: Packets: 1000001,1000004
	1Mping.sh: Interrupts: 1000001,1
	1Mping.sh: Notifications: 15385(0),1000003(2)
	Net IRQs triggered: 1000001(5),1(1000003)
After:
	1Gping-throughput.sh: Seconds: 11
	1Gping-throughput.sh: Packets: 1000001,999994
	1Gping-throughput.sh: Interrupts: 8336,1
	1Gping-throughput.sh: Notifications: 8334(0),8358(991646)
	Net IRQs triggered: 8336(3),1(8338)
	1Mping.sh: Seconds: 158
	1Mping.sh: Packets: 1000001,1000004
	1Mping.sh: Interrupts: 1000000,1
	1Mping.sh: Notifications: 15385(0),999987(18)
	Net IRQs triggered: 1000000(2),1(999987)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 Documentation/lguest/lguest.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -933,8 +933,15 @@ static void do_net_output(struct net_inf
 		errx(1, "Output buffers in net input queue?");
 
 	/* If we're going to block, make sure we trigger receive first. */
-	if (lg_last_avail(outvq) == outvq->vring.avail->idx)
-		trigger_irq(invq);
+	if (lg_last_avail(outvq) == outvq->vring.avail->idx) {
+		/* Try sleeping just a tiny bit. */
+		struct timeval tv = { 0, 50 };
+		select(0, NULL, NULL, NULL, &tv);
+
+		/* Still nothing? */
+		if (lg_last_avail(outvq) == outvq->vring.avail->idx)
+			trigger_irq(invq);
+	}
 
 	out_head = wait_for_vq_desc(outvq, outiov, &out, &dummy);
 	if (dummy)
