Commit b4b4ff73 authored by Xianting Tian's avatar Xianting Tian Committed by Michael S. Tsirkin

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: default avatarXianting Tian <xianting.tian@linux.alibaba.com>
Message-Id: <20220328105817.1028065-2-xianting.tian@linux.alibaba.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
parent 35c51e09
...@@ -517,7 +517,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, ...@@ -517,7 +517,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq,
descs_used = total_sg; 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", pr_debug("Can't add buf len %i - avail = %i\n",
descs_used, vq->vq.num_free); descs_used, vq->vq.num_free);
/* FIXME: for historical reasons, we force a notify here if /* FIXME: for historical reasons, we force a notify here if
......
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