qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Peter Maydell <peter.maydell@linaro.org>,
	Stefan Hajnoczi <stefanha@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Qemu and heavily increased RSS usage
Date: Fri, 24 Jun 2016 12:45:49 +0200	[thread overview]
Message-ID: <576D0F5D.8020608@kamp.de> (raw)
In-Reply-To: <CAFEAcA8S0dw=zFVp2213NPHrpOMy6F3NOaJZnk6NLOToeHzG3A@mail.gmail.com>

Am 24.06.2016 um 11:58 schrieb Peter Maydell:
> On 24 June 2016 at 10:37, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>> On Wed, Jun 22, 2016 at 09:56:06PM +0100, Peter Maydell wrote:
>>> On 22 June 2016 at 20:55, Peter Lieven <pl@kamp.de> wrote:
>>>> What makes the coroutine pool memory intensive is the stack size of 1MB per
>>>> coroutine. Is it really necessary to have such a big stack?
>>> That reminds me that I was wondering if we should allocate
>>> our coroutine stacks with MAP_GROWSDOWN (though if we're
>>> not actually using 1MB of stack then it's only going to
>>> be eating virtual memory, not necessarily real memory.)
>> Yes, MAP_GROWSDOWN will not reduce RSS.
> Right, but then the 1MB of stack as currently allocated isn't
> going to be affecting RSS either I would have thought (except
> transiently, since we zero it on allocation which will
> bring it into the RSS until it falls back out again
> because we don't touch it after that).

What I observe regarding the coroutine pool is really strange. Under I/O load
while booting the vServer the RSS size is low as expected. If the vServer runs
for some time the RSS size suddenly explodes as if suddenly all the stack memory gets
mapped. This symptom definetely goes away if I disable the pool.

Regarding the coroutine pool I had the following thoughts:
 - mmap the stack so its actually really freed if the coroutine is deleted (with MAP_GROWSDOWN or not?)
 - drop the release_pool. It has actually only an effect for non virtio devices where the coroutine is
   not created and deleted in the same thread. But for virtio the release pool has the drawback that there
   is always a pingpong between the release_pool and the alloc_pool.
 - implement some kind of garbage collector that detects that a threads alloc_pool is actually to big (e.g. it
   stays above a watermark for some time) and then reduce its size.
 - detect that a coroutine was created in a vcpu thread (e.g. IDE) and released in the iothread. In this case
   don't add it to the pool so the alloc_pool of the I/O thread does not grow to max without being used.

Peter

  reply	other threads:[~2016-06-24 10:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21  8:21 [Qemu-devel] Qemu and heavily increased RSS usage Peter Lieven
2016-06-21 13:18 ` Dr. David Alan Gilbert
2016-06-21 15:12   ` Peter Lieven
2016-06-22 10:56     ` Stefan Hajnoczi
2016-06-22 19:55       ` Peter Lieven
2016-06-22 20:56         ` Peter Maydell
2016-06-24  9:37           ` Stefan Hajnoczi
2016-06-24  9:53             ` Peter Lieven
2016-06-24  9:57               ` Dr. David Alan Gilbert
2016-06-24  9:58             ` Peter Maydell
2016-06-24 10:45               ` Peter Lieven [this message]
2016-06-27 12:39                 ` Stefan Hajnoczi
2016-06-27 13:33                   ` Peter Lieven
2016-06-23  9:57   ` Peter Lieven
2016-06-24 22:57     ` Michael S. Tsirkin
2016-06-23 14:58   ` Peter Lieven
2016-06-23 15:00     ` Dr. David Alan Gilbert
2016-06-23 15:02       ` Peter Lieven
2016-06-23 15:21     ` Paolo Bonzini
2016-06-23 15:31       ` Peter Lieven
2016-06-23 15:47         ` Paolo Bonzini
2016-06-23 16:19           ` Peter Lieven
2016-06-23 16:53             ` Paolo Bonzini
2016-06-23 21:28               ` Peter Lieven
2016-06-24  4:10                 ` Paolo Bonzini
2016-06-24  8:11                   ` Peter Lieven
2016-06-24  8:20                     ` Paolo Bonzini
2016-06-24  8:45                       ` Peter Lieven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576D0F5D.8020608@kamp.de \
    --to=pl@kamp.de \
    --cc=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).