Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751755AbaJOEh7 (ORCPT ); Wed, 15 Oct 2014 00:37:59 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:28638 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750845AbaJOEh6 (ORCPT ); Wed, 15 Oct 2014 00:37:58 -0400 From: "Denis V. Lunev" Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Raushaniya Maksudova , "Denis V. Lunev" , Rusty Russell , "Michael S. Tsirkin" Subject: [PATCH 1/2] virtio_balloon: return the amount of freed memory from leak_balloon() Date: Wed, 15 Oct 2014 08:38:09 +0400 Message-Id: <1413347890-18561-2-git-send-email-den@openvz.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413347890-18561-1-git-send-email-den@openvz.org> References: <1413347890-18561-1-git-send-email-den@openvz.org> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Raushaniya Maksudova This value would be useful in the next patch to provide the amount of the freed memory for OOM killer. Signed-off-by: Raushaniya Maksudova Signed-off-by: Denis V. Lunev CC: Rusty Russell CC: Michael S. Tsirkin --- drivers/virtio/virtio_balloon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index f893148..66cac10 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -168,8 +168,9 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num) } } -static void leak_balloon(struct virtio_balloon *vb, size_t num) +static unsigned leak_balloon(struct virtio_balloon *vb, size_t num) { + unsigned num_freed_pages; struct page *page; struct balloon_dev_info *vb_dev_info = &vb->vb_dev_info; @@ -186,6 +187,7 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num) vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE; } + num_freed_pages = vb->num_pfns; /* * Note that if * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); @@ -195,6 +197,7 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num) tell_host(vb, vb->deflate_vq); mutex_unlock(&vb->balloon_lock); release_pages_by_pfn(vb->pfns, vb->num_pfns); + return num_freed_pages; } static inline void update_stat(struct virtio_balloon *vb, int idx, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/