Skip to content

Commit d9e427f

Browse files
jstancekmstsirkin
authored andcommitted
virtio_balloon: fix increment of vb->num_pfns in fill_balloon()
commit c7cdff0 ("virtio_balloon: fix deadlock on OOM") changed code to increment vb->num_pfns before call to set_page_pfns(), which used to happen only after. This patch fixes boot hang for me on ppc64le KVM guests. Fixes: c7cdff0 ("virtio_balloon: fix deadlock on OOM") Cc: Michael S. Tsirkin <[email protected]> Cc: Tetsuo Handa <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Wei Wang <[email protected]> Cc: [email protected] Signed-off-by: Jan Stancek <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent e60ea67 commit d9e427f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/virtio/virtio_balloon.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,12 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num)
174174
while ((page = balloon_page_pop(&pages))) {
175175
balloon_page_enqueue(&vb->vb_dev_info, page);
176176

177-
vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
178-
179177
set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
180178
vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
181179
if (!virtio_has_feature(vb->vdev,
182180
VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
183181
adjust_managed_page_count(page, -1);
182+
vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
184183
}
185184

186185
num_allocated_pages = vb->num_pfns;

0 commit comments

Comments
 (0)