[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190718015319-mutt-send-email-mst@kernel.org>
Date: Thu, 18 Jul 2019 01:58:16 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Wei Wang <wei.w.wang@...el.com>
Cc: Alexander Duyck <alexander.duyck@...il.com>,
Nitesh Narayan Lal <nitesh@...hat.com>,
kvm list <kvm@...r.kernel.org>,
David Hildenbrand <david@...hat.com>,
"Hansen, Dave" <dave.hansen@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Yang Zhang <yang.zhang.wz@...il.com>,
"pagupta@...hat.com" <pagupta@...hat.com>,
Rik van Riel <riel@...riel.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
"lcapitulino@...hat.com" <lcapitulino@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
"Williams, Dan J" <dan.j.williams@...el.com>,
Alexander Duyck <alexander.h.duyck@...ux.intel.com>
Subject: Re: use of shrinker in virtio balloon free page hinting
On Thu, Jul 18, 2019 at 01:57:06PM +0800, Wei Wang wrote:
> On 07/18/2019 12:13 PM, Michael S. Tsirkin wrote:
> >
> > It makes sense for pages in the balloon (requested by hypervisor).
> > However free page hinting can freeze up lots of memory for its own
> > internal reasons. It does not make sense to ask hypervisor
> > to set flags in order to fix internal guest issues.
>
> Sounds reasonable to me. Probably we could move the flag check to
> shrinker_count and shrinker_scan as a reclaiming condition for
> ballooning pages only?
I think so, yes. I also wonder whether we should stop reporting
at that point - otherwise we'll just allocate the freed pages again.
>
> >
> > Right. But that does not include the pages in the hint vq,
> > which could be a significant amount of memory.
>
> I think it includes, as vb->num_free_page_blocks records the total number
> of free page blocks that balloon has taken from mm.
Oh - you are right. Thanks!
> For shrink_free_pages, it calls return_free_pages_to_mm, which pops pages
> from vb->free_page_list (this is the list where pages get enlisted after
> they
> are put to the hint vq, see get_free_page_and_send).
>
>
> >
> >
> > > > - if free pages are being reported, pages freed
> > > > by shrinker will just get re-allocated again
> > > fill_balloon will re-try the allocation after sleeping 200ms once allocation fails.
> > Even if ballon was never inflated, if shrinker frees some memory while
> > we are hinting, hint vq will keep going and allocate it back without
> > sleeping.
>
> Still see get_free_page_and_send. -EINTR is returned when page allocation
> fails,
> and reporting ends then.
what if it does not fail?
>
> Shrinker is called on system memory pressure. On memory pressure
> get_free_page_and_send will fail memory allocation, so it stops allocating
> more.
Memory pressure could be triggered by an unrelated allocation
e.g. from another driver.
>
>
> Best,
> Wei
Powered by blists - more mailing lists