[PATCH 2/2] virtio_balloon: fix shrinker_scan return units
From: Khazhismel Kumykov
Date: Mon Nov 18 2019 - 16:39:01 EST
We were returning number of virtio balloon pages, which may not be the
same as number of system pages
Fixes: 86a559787e6f ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
Cc: Wei Wang <wei.w.wang@xxxxxxxxx>
Signed-off-by: Khazhismel Kumykov <khazhy@xxxxxxxxxx>
---
drivers/virtio/virtio_balloon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 7cf9540a40b8..7951ece3fe24 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -802,11 +802,11 @@ static unsigned long virtio_balloon_shrinker_scan(struct shrinker *shrinker,
pages_freed = shrink_free_pages(vb, pages_to_free);
if (pages_freed >= pages_to_free)
- return pages_freed;
+ return pages_freed / VIRTIO_BALLOON_PAGES_PER_PAGE;
pages_freed += shrink_balloon_pages(vb, pages_to_free - pages_freed);
- return pages_freed;
+ return pages_freed / VIRTIO_BALLOON_PAGES_PER_PAGE;
}
static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
--
2.24.0.432.g9d3f5f5b63-goog