diff options
author | Jan Stancek <jstancek@redhat.com> | 2017-12-01 04:50:28 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-12-01 09:55:45 -0500 |
commit | d9e427f6ab8142d6868eb719e6a7851aafea56b6 (patch) | |
tree | 1b3ad23a6cab1524eea800de336efc0f6bd9d277 /drivers/virtio/virtio_balloon.c | |
parent | e60ea67bb60459b95a50a156296041a13e0e380e (diff) |
virtio_balloon: fix increment of vb->num_pfns in fill_balloon()
commit c7cdff0e8647 ("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: c7cdff0e8647 ("virtio_balloon: fix deadlock on OOM")
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Wei Wang <wei.w.wang@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio/virtio_balloon.c')
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 7960746f7597..a1fb52cb3f0a 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -174,13 +174,12 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num) | |||
174 | while ((page = balloon_page_pop(&pages))) { | 174 | while ((page = balloon_page_pop(&pages))) { |
175 | balloon_page_enqueue(&vb->vb_dev_info, page); | 175 | balloon_page_enqueue(&vb->vb_dev_info, page); |
176 | 176 | ||
177 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE; | ||
178 | |||
179 | set_page_pfns(vb, vb->pfns + vb->num_pfns, page); | 177 | set_page_pfns(vb, vb->pfns + vb->num_pfns, page); |
180 | vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; | 178 | vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; |
181 | if (!virtio_has_feature(vb->vdev, | 179 | if (!virtio_has_feature(vb->vdev, |
182 | VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) | 180 | VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) |
183 | adjust_managed_page_count(page, -1); | 181 | adjust_managed_page_count(page, -1); |
182 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE; | ||
184 | } | 183 | } |
185 | 184 | ||
186 | num_allocated_pages = vb->num_pfns; | 185 | num_allocated_pages = vb->num_pfns; |