Skip to content

Commit c9a6820

Browse files
wei-w-wangmstsirkin
authored andcommitted
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: [email protected] Fixes: 7199462 ("virtio_balloon: replace oom notifier with shrinker") Signed-off-by: Wei Wang <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: David Hildenbrand <[email protected]>
1 parent 60bd04f commit c9a6820

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/virtio/virtio_balloon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
826826
unsigned long count;
827827

828828
count = vb->num_pages / VIRTIO_BALLOON_PAGES_PER_PAGE;
829-
count += vb->num_free_page_blocks >> VIRTIO_BALLOON_FREE_PAGE_ORDER;
829+
count += vb->num_free_page_blocks << VIRTIO_BALLOON_FREE_PAGE_ORDER;
830830

831831
return count;
832832
}

0 commit comments

Comments
 (0)