From: Jason Wang <jasowang@redhat.com> To: Xianting Tian <xianting.tian@linux.alibaba.com> Cc: virtualization <virtualization@lists.linux-foundation.org>, linux-kernel <linux-kernel@vger.kernel.org>, mst <mst@redhat.com> Subject: Re: [PATCH 1/2] virtio_ring: remove unnecessary to_vvq call in vring hot path Date: Tue, 29 Mar 2022 12:56:46 +0800 [thread overview] Message-ID: <CACGkMEvgcJy3k-s39QeLkLFho_wpsBnEbrcHWugajy50qjAo-w@mail.gmail.com> (raw) In-Reply-To: <20220328105817.1028065-1-xianting.tian@linux.alibaba.com> On Mon, Mar 28, 2022 at 6:58 PM Xianting Tian <xianting.tian@linux.alibaba.com> wrote: > > It passes '_vq' to virtqueue_use_indirect(), which still calls > to_vvq to get 'vq', let's directly pass 'vq'. It can avoid > unnecessary call of to_vvq in hot path. > > Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com> Acked-by: Jason Wang <jasowang@redhat.com> > --- > drivers/virtio/virtio_ring.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index 962f1477b1fa..d597fc0874ec 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -205,11 +205,9 @@ struct vring_virtqueue { > > #define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq) > > -static inline bool virtqueue_use_indirect(struct virtqueue *_vq, > +static inline bool virtqueue_use_indirect(struct vring_virtqueue *vq, > unsigned int total_sg) > { > - struct vring_virtqueue *vq = to_vvq(_vq); > - > /* > * If the host supports indirect descriptor tables, and we have multiple > * buffers, then go indirect. FIXME: tune this threshold > @@ -507,7 +505,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, > > head = vq->free_head; > > - if (virtqueue_use_indirect(_vq, total_sg)) > + if (virtqueue_use_indirect(vq, total_sg)) > desc = alloc_indirect_split(_vq, total_sg, gfp); > else { > desc = NULL; > @@ -1194,7 +1192,7 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, > > BUG_ON(total_sg == 0); > > - if (virtqueue_use_indirect(_vq, total_sg)) { > + if (virtqueue_use_indirect(vq, total_sg)) { > err = virtqueue_add_indirect_packed(vq, sgs, total_sg, out_sgs, > in_sgs, data, gfp); > if (err != -ENOMEM) { > -- > 2.17.1 > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com> To: Xianting Tian <xianting.tian@linux.alibaba.com> Cc: mst <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, virtualization <virtualization@lists.linux-foundation.org>, linux-kernel <linux-kernel@vger.kernel.org> Subject: Re: [PATCH 1/2] virtio_ring: remove unnecessary to_vvq call in vring hot path Date: Tue, 29 Mar 2022 12:56:46 +0800 [thread overview] Message-ID: <CACGkMEvgcJy3k-s39QeLkLFho_wpsBnEbrcHWugajy50qjAo-w@mail.gmail.com> (raw) In-Reply-To: <20220328105817.1028065-1-xianting.tian@linux.alibaba.com> On Mon, Mar 28, 2022 at 6:58 PM Xianting Tian <xianting.tian@linux.alibaba.com> wrote: > > It passes '_vq' to virtqueue_use_indirect(), which still calls > to_vvq to get 'vq', let's directly pass 'vq'. It can avoid > unnecessary call of to_vvq in hot path. > > Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com> Acked-by: Jason Wang <jasowang@redhat.com> > --- > drivers/virtio/virtio_ring.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index 962f1477b1fa..d597fc0874ec 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -205,11 +205,9 @@ struct vring_virtqueue { > > #define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq) > > -static inline bool virtqueue_use_indirect(struct virtqueue *_vq, > +static inline bool virtqueue_use_indirect(struct vring_virtqueue *vq, > unsigned int total_sg) > { > - struct vring_virtqueue *vq = to_vvq(_vq); > - > /* > * If the host supports indirect descriptor tables, and we have multiple > * buffers, then go indirect. FIXME: tune this threshold > @@ -507,7 +505,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, > > head = vq->free_head; > > - if (virtqueue_use_indirect(_vq, total_sg)) > + if (virtqueue_use_indirect(vq, total_sg)) > desc = alloc_indirect_split(_vq, total_sg, gfp); > else { > desc = NULL; > @@ -1194,7 +1192,7 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, > > BUG_ON(total_sg == 0); > > - if (virtqueue_use_indirect(_vq, total_sg)) { > + if (virtqueue_use_indirect(vq, total_sg)) { > err = virtqueue_add_indirect_packed(vq, sgs, total_sg, out_sgs, > in_sgs, data, gfp); > if (err != -ENOMEM) { > -- > 2.17.1 >
next prev parent reply other threads:[~2022-03-29 4:57 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-28 10:58 [PATCH 1/2] virtio_ring: remove unnecessary to_vvq call in vring hot path Xianting Tian 2022-03-28 10:58 ` [PATCH 2/2] virtio_ring: add unlikely annotation for free descs check Xianting Tian 2022-03-29 4:57 ` Jason Wang 2022-03-29 4:57 ` Jason Wang 2022-03-29 7:50 ` Stefano Garzarella 2022-03-29 7:50 ` Stefano Garzarella 2022-04-04 15:11 ` Xianting Tian 2022-04-04 16:27 ` Michael S. Tsirkin 2022-04-04 16:27 ` Michael S. Tsirkin 2022-03-29 4:56 ` Jason Wang [this message] 2022-03-29 4:56 ` [PATCH 1/2] virtio_ring: remove unnecessary to_vvq call in vring hot path Jason Wang 2022-03-29 7:49 ` Stefano Garzarella 2022-03-29 7:49 ` Stefano Garzarella
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CACGkMEvgcJy3k-s39QeLkLFho_wpsBnEbrcHWugajy50qjAo-w@mail.gmail.com \ --to=jasowang@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mst@redhat.com \ --cc=virtualization@lists.linux-foundation.org \ --cc=xianting.tian@linux.alibaba.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.