aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXianting Tian <[email protected]>2022-03-28 18:58:17 +0800
committerMichael S. Tsirkin <[email protected]>2022-05-31 12:44:25 -0400
commitb4b4ff73ef047556e81694174bb8561457f25eeb (patch)
tree9df63bff412bf25099bf120abd2705a9d92d2cc4
parent35c51e093d956f6d058e193711c8d424817a44a9 (diff)
virtio_ring: add unlikely annotation for free descs check
The 'if (vq->vq.num_free < descs_used)' check will almost always be false. Signed-off-by: Xianting Tian <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]> Reviewed-by: Stefano Garzarella <[email protected]>
-rw-r--r--drivers/virtio/virtio_ring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index f72d5ae2cd8f..0dc930de72f5 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -517,7 +517,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq,
descs_used = total_sg;
}
- if (vq->vq.num_free < descs_used) {
+ if (unlikely(vq->vq.num_free < descs_used)) {
pr_debug("Can't add buf len %i - avail = %i\n",
descs_used, vq->vq.num_free);
/* FIXME: for historical reasons, we force a notify here if