[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191118175339-mutt-send-email-mst@kernel.org>
Date: Mon, 18 Nov 2019 17:56:24 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Khazhismel Kumykov <khazhy@...gle.com>
Cc: jasowang@...hat.com, wei.w.wang@...el.com,
linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH 2/2] virtio_balloon: fix shrinker_scan return units
On Mon, Nov 18, 2019 at 01:38:11PM -0800, Khazhismel Kumykov wrote:
> 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@...el.com>
> Signed-off-by: Khazhismel Kumykov <khazhy@...gle.com>
> ---
> 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;
>
I'm no seeing why is this one right. shrink_free_pages gives result
in PAGE_SIZE units, right?
> pages_freed += shrink_balloon_pages(vb, pages_to_free - pages_freed);
>
> - return pages_freed;
> + return pages_freed / VIRTIO_BALLOON_PAGES_PER_PAGE;
My head hurts. Isn't this what patch 1 tweaked?
> }
>
> static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
> --
> 2.24.0.432.g9d3f5f5b63-goog
Powered by blists - more mailing lists