public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bo Liu (刘波)-浪潮信息" <liubo03@inspur.com>
To: "mst@redhat.com" <mst@redhat.com>
Cc: "jasowang@redhat.com" <jasowang@redhat.com>,
	"virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] virtio_ring: remove unnecessary to_vvq() call
Date: Wed, 28 Sep 2022 02:26:16 +0000	[thread overview]
Message-ID: <4366e621c74e46bfa642d6802187ad44@inspur.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2368 bytes --]

>On Mon, Sep 26, 2022 at 05:11:30AM -0400, Bo Liu wrote:
>> It passes '_vq' to vring_free(), 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: Bo Liu <liubo03@inspur.com>
>
>What is the point of this change?
>
>__vring_new_virtqueue returns struct virtqueue *, so vring_free matches
that.
>No?
>

Hi
In function vring_free(), to_vvq() js unnecessary, we can directly pass
struct vring_virtqueue * to avoid this and remove the unnecessary code.

>> ---
>>  drivers/virtio/virtio_ring.c | 12 +++++-------
>>  1 file changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/virtio/virtio_ring.c
>> b/drivers/virtio/virtio_ring.c index 8974c34b40fd..d6d77bf58802 100644
>> --- a/drivers/virtio/virtio_ring.c
>> +++ b/drivers/virtio/virtio_ring.c
>> @@ -221,7 +221,7 @@ static struct virtqueue
>*__vring_new_virtqueue(unsigned int index,
>>  					       void (*callback)(struct
virtqueue *),
>>  					       const char *name);
>>  static struct vring_desc_extra *vring_alloc_desc_extra(unsigned int
>> num); -static void vring_free(struct virtqueue *_vq);
>> +static void vring_free(struct vring_virtqueue *vq);
>>
>>  /*
>>   * Helpers.
>> @@ -1140,7 +1140,7 @@ static int virtqueue_resize_split(struct virtqueue
>*_vq, u32 num)
>>  	if (err)
>>  		goto err_state_extra;
>>
>> -	vring_free(&vq->vq);
>> +	vring_free(vq);
>>
>>  	virtqueue_vring_init_split(&vring_split, vq);
>>
>> @@ -2059,7 +2059,7 @@ static int virtqueue_resize_packed(struct virtqueue
>*_vq, u32 num)
>>  	if (err)
>>  		goto err_state_extra;
>>
>> -	vring_free(&vq->vq);
>> +	vring_free(vq);
>>
>>  	virtqueue_vring_init_packed(&vring_packed, !!vq->vq.callback);
>>
>> @@ -2649,10 +2649,8 @@ struct virtqueue *vring_new_virtqueue(unsigned
>> int index,  }  EXPORT_SYMBOL_GPL(vring_new_virtqueue);
>>
>> -static void vring_free(struct virtqueue *_vq)
>> +static void vring_free(struct vring_virtqueue *vq)
>>  {
>> -	struct vring_virtqueue *vq = to_vvq(_vq);
>> -
>>  	if (vq->we_own_ring) {
>>  		if (vq->packed_ring) {
>>  			vring_free_queue(vq->vq.vdev,
>> @@ -2693,7 +2691,7 @@ void vring_del_virtqueue(struct virtqueue *_vq)
>>  	list_del(&_vq->list);
>>  	spin_unlock(&vq->vq.vdev->vqs_list_lock);
>>
>> -	vring_free(_vq);
>> +	vring_free(vq);
>>
>>  	kfree(vq);
>>  }
>> --
>> 2.27.0


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3777 bytes --]

             reply	other threads:[~2022-09-28  2:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28  2:26 Bo Liu (刘波)-浪潮信息 [this message]
2022-09-28  4:04 ` [PATCH] virtio_ring: remove unnecessary to_vvq() call Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2022-09-26  9:11 Bo Liu
2022-09-27  4:03 ` Jason Wang
2022-09-27 20:30 ` Michael S. Tsirkin
2022-06-08  0:57 [PATCH] virtio_ring: remove unnecessary to_vvq call Bo Liu (刘波)-浪潮信息
2022-06-07  8:08 Bo Liu (刘波)-浪潮信息
2022-06-07 10:36 ` Michael S. Tsirkin
2022-06-07  0:59 Bo Liu
2022-06-07  6:38 ` Michael S. Tsirkin

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=4366e621c74e46bfa642d6802187ad44@inspur.com \
    --to=liubo03@inspur.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox