[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACGdZY+7qxQGjK2ZzT+LMacGWQHGSZ=iLhDOwPVKvtdm9_1qZA@mail.gmail.com>
Date: Wed, 20 Nov 2019 11:07:52 -0800
From: Khazhismel Kumykov <khazhy@...gle.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Wei Wang <wei.w.wang@...el.com>,
Jason Wang <jasowang@...hat.com>,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v2] virtio_balloon: fix shrinker scan number of pages
On Tue, Nov 19, 2019 at 11:18 PM Michael S. Tsirkin <mst@...hat.com> wrote:
>
> virtio_balloon_shrinker_scan should return number of system pages freed,
> but because it's calling functions that deal with balloon pages, it gets
> confused and sometimes returns the number of balloon pages.
>
> It does not matter practically as the exact number isn't
> used, but it seems better to be consistent in case someone
> starts using this API.
>
> Further, if we ever tried to iteratively leak pages as
> virtio_balloon_shrinker_scan tries to do, we'd run into issues - this is
> because freed_pages was accumulating total freed pages, but was also
> subtracted on each iteration from pages_to_free, which can result in
> either leaking less memory than we were supposed to free, or more if
> pages_to_free underruns.
>
> On a system with 4K pages we are lucky that we are never asked to leak
> more than 128 pages while we can leak up to 256 at a time,
> but it looks like a real issue for systems with page size != 4K.
>
> Fixes: 71994620bb25 ("virtio_balloon: replace oom notifier with shrinker")
> Reported-by: Khazhismel Kumykov <khazhy@...gle.com>
> Reviewed-by: Wei Wang <wei.w.wang@...el.com>
> Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
Reviewed-by: Khazhismel Kumykov <khazhy@...gle.com>
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4843 bytes)
Powered by blists - more mailing lists