From: "richard.peng@oppo.com" <richard.peng@oppo.com>
To: mst <mst@redhat.com>, davem <davem@davemloft.net>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] vhost/vsock: Micro optimize error handle
Date: Mon, 23 Sep 2019 15:41:00 +0800 [thread overview]
Message-ID: <2019092315405925910511@oppo.com> (raw)
When a vq error, there is no need to operate on the unmodified vq.
Signed-off-by:Peng Hao <richard.peng@oppo.com>
---
drivers/vhost/vsock.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index 6a50e1d..0bed19d 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -437,7 +437,7 @@ static void vhost_vsock_handle_rx_kick(struct vhost_work *work)
static int vhost_vsock_start(struct vhost_vsock *vsock)
{
struct vhost_virtqueue *vq;
- size_t i;
+ size_t i, j;
int ret;
mutex_lock(&vsock->dev.mutex);
@@ -473,8 +473,8 @@ static int vhost_vsock_start(struct vhost_vsock *vsock)
vq->private_data = NULL;
mutex_unlock(&vq->mutex);
- for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) {
- vq = &vsock->vqs[i];
+ for (j = 0; j < i; j++) {
+ vq = &vsock->vqs[j];
mutex_lock(&vq->mutex);
vq->private_data = NULL;
--
2.7.4
reply other threads:[~2019-09-23 7:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=2019092315405925910511@oppo.com \
--to=richard.peng@oppo.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.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: 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