From: Xianting Tian Date: Mon, 28 Mar 2022 10:58:17 +0000 (+0800) Subject: virtio_ring: add unlikely annotation for free descs check X-Git-Tag: baikal/mips/sdk6.1~5593^2~54 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=8169ecdacfa36d9a15ac9c0c7096b17ac4ad3baf;p=kernel.git 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 Message-Id: <20220328105817.1028065-2-xianting.tian@linux.alibaba.com> Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Reviewed-by: Stefano Garzarella --- diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index f72d5ae2cd8fd..0dc930de72f5a 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