[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACGkMEsVjcQGLr8=OwpbhSJY3_Nn_am_YK7gQKdvV6PKUb9qRw@mail.gmail.com>
Date: Tue, 29 Mar 2022 12:57:59 +0800
From: Jason Wang <jasowang@...hat.com>
To: Xianting Tian <xianting.tian@...ux.alibaba.com>
Cc: mst <mst@...hat.com>, Stefano Garzarella <sgarzare@...hat.com>,
virtualization <virtualization@...ts.linux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] virtio_ring: add unlikely annotation for free descs check
On Mon, Mar 28, 2022 at 6:58 PM Xianting Tian
<xianting.tian@...ux.alibaba.com> wrote:
>
> The 'if (vq->vq.num_free < descs_used)' check will almost always be false.
>
> Signed-off-by: Xianting Tian <xianting.tian@...ux.alibaba.com>
Acked-by: Jason Wang <jasowang@...hat.com>
> ---
> drivers/virtio/virtio_ring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index d597fc0874ec..ab6d5f0cb579 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -525,7 +525,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
> --
> 2.17.1
>
Powered by blists - more mailing lists