[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1389889445-3855-5-git-send-email-lcapitulino@redhat.com>
Date: Thu, 16 Jan 2014 11:24:05 -0500
From: Luiz Capitulino <lcapitulino@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: kvm@...r.kernel.org, riel@...hat.com, aarcange@...hat.com,
aquini@...hat.com, mst@...hat.com, rusty@...tcorp.com.au,
vdavydov@...allels.com, amit.shah@...hat.com, dfediuck@...hat.com,
agl@...ibm.com
Subject: [RFC PATCH 4/4] virtio_balloon: skip inflation if guest is under pressure
From: Luiz capitulino <lcapitulino@...hat.com>
This is necessary for automatic ballooning. If the guest gets
under pressure while there's an on-going inflation operation,
we want the guest to do the following:
1. Stop on-going inflation
2. Notify the host we're under pressure
3. Wait for host's acknowledge
While the guest is waiting the host has the opportunity to
reset num_pages to a value before the guest got into pressure.
This will cancel current inflation.
Signed-off-by: Luiz capitulino <lcapitulino@...hat.com>
---
drivers/virtio/virtio_balloon.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 1c3ee71..7f5b7d2 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -188,8 +188,13 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num)
mutex_lock(&vb->balloon_lock);
for (vb->num_pfns = 0; vb->num_pfns < num;
vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {
- struct page *page = balloon_page_enqueue(vb_dev_info);
+ struct page *page;
+ if (guest_under_pressure(vb)) {
+ break;
+ }
+
+ page = balloon_page_enqueue(vb_dev_info);
if (!page) {
dev_info_ratelimited(&vb->vdev->dev,
"Out of puff! Can't get %u pages\n",
--
1.8.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists