mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] virtio-balloon: move release_pages_balloon() outside of mutex_unlock(&vb->balloon_lock)
@ 2021-03-26  9:53 Liu Xiang
  2021-03-26 11:13 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Xiang @ 2021-03-26  9:53 UTC (permalink / raw)
  To: mst
  Cc: david, jasowang, virtualization, linux-kernel, liuxiang_1999,
	liuxiang1999, Liu Xiang

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-26 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26  9:53 [PATCH] virtio-balloon: move release_pages_balloon() outside of mutex_unlock(&vb->balloon_lock) Liu Xiang
2021-03-26 11:13 ` David Hildenbrand

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®