mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liu Xiang <liu.xiang@zlingsmart.com>
To: mst@redhat.com
Cc: david@redhat.com, jasowang@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, liuxiang_1999@126.com,
	liuxiang1999@gmail.com, Liu Xiang <liu.xiang@zlingsmart.com>
Subject: [PATCH] virtio-balloon: move release_pages_balloon() outside of mutex_unlock(&vb->balloon_lock)
Date: Fri, 26 Mar 2021 17:53:26 +0800	[thread overview]
Message-ID: <20210326095326.13221-1-liu.xiang@zlingsmart.com> (raw)

Since pages have been deflated to a local list,
there is no race between fill and leak.

Signed-off-by: Liu Xiang <liu.xiang@zlingsmart.com>
---
 drivers/virtio/virtio_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 8985fc2ce..7da25b87f 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -303,8 +303,8 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
 	 */
 	if (vb->num_pfns != 0)
 		tell_host(vb, vb->deflate_vq);
-	release_pages_balloon(vb, &pages);
 	mutex_unlock(&vb->balloon_lock);
+	release_pages_balloon(vb, &pages);
 	return num_freed_pages;
 }
 
-- 
2.17.1


             reply	other threads:[~2021-03-26  9:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26  9:53 Liu Xiang [this message]
2021-03-26 11:13 ` David Hildenbrand

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=20210326095326.13221-1-liu.xiang@zlingsmart.com \
    --to=liu.xiang@zlingsmart.com \
    --cc=david@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuxiang1999@gmail.com \
    --cc=liuxiang_1999@126.com \
    --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

all inboxes | Powered by JetHome®