Commit 948a8ac2 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Michael S. Tsirkin

ringtest: poll for new buffers once before updating event index

Updating the event index has a memory barrier and causes more work
on the other side to actually signal the event.  It is unnecessary
if a new buffer has already appeared on the ring, so poll once before
doing the update.

The effect of this on the 0.9 ring implementation is pretty much
invisible, but on the new-style ring it provides a consistent 3%
performance improvement.
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent d3c3589b
...@@ -147,7 +147,7 @@ static void __attribute__((__flatten__)) run_guest(void) ...@@ -147,7 +147,7 @@ static void __attribute__((__flatten__)) run_guest(void)
assert(completed <= bufs); assert(completed <= bufs);
assert(started <= bufs); assert(started <= bufs);
if (do_sleep) { if (do_sleep) {
if (enable_call()) if (used_empty() && enable_call())
wait_for_call(); wait_for_call();
} else { } else {
poll_used(); poll_used();
...@@ -172,7 +172,7 @@ static void __attribute__((__flatten__)) run_host(void) ...@@ -172,7 +172,7 @@ static void __attribute__((__flatten__)) run_host(void)
for (;;) { for (;;) {
if (do_sleep) { if (do_sleep) {
if (enable_kick()) if (avail_empty() && enable_kick())
wait_for_kick(); wait_for_kick();
} else { } else {
poll_avail(); poll_avail();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment