vhost: add unlikely annotations to error path

patch 'break out of polling loop on error' caused
a minor performance regression on my machine: recover
that performance by adding a bunch of unlikely annotations
in the error handling.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Michael S. Tsirkin
2010-07-01 18:40:12 +03:00
parent d5675bd204
commit 7b3384fc30
2 changed files with 29 additions and 28 deletions

View File

@@ -137,7 +137,7 @@ static void handle_tx(struct vhost_net *net)
&out, &in,
NULL, NULL);
/* On error, stop handling until the next kick. */
if (head < 0)
if (unlikely(head < 0))
break;
/* Nothing new? Wait for eventfd to tell us they refilled. */
if (head == vq->num) {
@@ -234,7 +234,7 @@ static void handle_rx(struct vhost_net *net)
&out, &in,
vq_log, &log);
/* On error, stop handling until the next kick. */
if (head < 0)
if (unlikely(head < 0))
break;
/* OK, now we need to know about added descriptors. */
if (head == vq->num) {