summaryrefslogtreecommitdiffstats
path: root/Documentation/lguest/lguest.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-09-19 09:15:50 +0200
committerIngo Molnar <mingo@elte.hu>2008-09-19 09:15:50 +0200
commit5e51900be6c15488b80343d3c3e62d4d605ba9a9 (patch)
tree99e60bbc949e066503b598893998286c8a42861d /Documentation/lguest/lguest.c
parentx86 setup: drop SWAP_DEV (diff)
parentLinux 2.6.27-rc6 (diff)
downloadlinux-5e51900be6c15488b80343d3c3e62d4d605ba9a9.tar.xz
linux-5e51900be6c15488b80343d3c3e62d4d605ba9a9.zip
Merge commit 'v2.6.27-rc6' into x86/cleanups
Diffstat (limited to 'Documentation/lguest/lguest.c')
-rw-r--r--Documentation/lguest/lguest.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 655414821edc..7228369d1014 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -895,6 +895,9 @@ static void handle_console_output(int fd, struct virtqueue *vq, bool timeout)
}
}
+/* This is called when we no longer want to hear about Guest changes to a
+ * virtqueue. This is more efficient in high-traffic cases, but it means we
+ * have to set a timer to check if any more changes have occurred. */
static void block_vq(struct virtqueue *vq)
{
struct itimerval itm;
@@ -939,6 +942,11 @@ static void handle_net_output(int fd, struct virtqueue *vq, bool timeout)
if (!timeout && num)
block_vq(vq);
+ /* We never quite know how long should we wait before we check the
+ * queue again for more packets. We start at 500 microseconds, and if
+ * we get fewer packets than last time, we assume we made the timeout
+ * too small and increase it by 10 microseconds. Otherwise, we drop it
+ * by one microsecond every time. It seems to work well enough. */
if (timeout) {
if (num < last_timeout_num)
timeout_usec += 10;