summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Wang <wei.w.wang@intel.com>2019-11-19 11:02:33 +0100
committerMichael S. Tsirkin <mst@redhat.com>2019-11-20 08:15:57 +0100
commitc9a6820fc0da2603be3054ee7590eb9f350508a7 (patch)
tree5a10145a9b42125955879b8437c93448b2a12a4b
parentvirtio_balloon: fix shrinker scan number of pages (diff)
downloadlinux-c9a6820fc0da2603be3054ee7590eb9f350508a7.tar.xz
linux-c9a6820fc0da2603be3054ee7590eb9f350508a7.zip
virtio_balloon: fix shrinker count
Instead of multiplying by page order, virtio balloon divided by page order. The result is that it can return 0 if there are a bit less than MAX_ORDER - 1 pages in use, and then shrinker scan won't be called. Cc: stable@vger.kernel.org Fixes: 71994620bb25 ("virtio_balloon: replace oom notifier with shrinker") Signed-off-by: Wei Wang <wei.w.wang@intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com>
-rw-r--r--drivers/virtio/virtio_balloon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 51134f9a3ee7..e05679c478e2 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -826,7 +826,7 @@ static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
unsigned long count;
count = vb->num_pages / VIRTIO_BALLOON_PAGES_PER_PAGE;
- count += vb->num_free_page_blocks >> VIRTIO_BALLOON_FREE_PAGE_ORDER;
+ count += vb->num_free_page_blocks << VIRTIO_BALLOON_FREE_PAGE_ORDER;
return count;
}