qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [PATCH] coroutine: reserve 5,000 mappings
Date: Thu, 21 Mar 2024 10:43:30 +0000	[thread overview]
Message-ID: <ZfwPUtYHSJpLJz1l@redhat.com> (raw)
In-Reply-To: <20240320181232.1464819-1-stefanha@redhat.com>

On Wed, Mar 20, 2024 at 02:12:32PM -0400, Stefan Hajnoczi wrote:
> Daniel P. Berrangé <berrange@redhat.com> pointed out that the coroutine
> pool size heuristic is very conservative. Instead of halving
> max_map_count, he suggested reserving 5,000 mappings for non-coroutine
> users based on observations of guests he has access to.
> 
> Fixes: 86a637e48104 ("coroutine: cap per-thread local pool size")

It wasn't really broken, so "Tweaks" or "Enhances" rather than
"Fixes" if you like :-)

> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  util/qemu-coroutine.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
> index 2790959eaf..eb4eebefdf 100644
> --- a/util/qemu-coroutine.c
> +++ b/util/qemu-coroutine.c
> @@ -377,12 +377,17 @@ static unsigned int get_global_pool_hard_max_size(void)
>                              NULL) &&
>          qemu_strtoi(contents, NULL, 10, &max_map_count) == 0) {
>          /*
> -         * This is a conservative upper bound that avoids exceeding
> -         * max_map_count. Leave half for non-coroutine users like library
> -         * dependencies, vhost-user, etc. Each coroutine takes up 2 VMAs so
> -         * halve the amount again.
> +         * This is an upper bound that avoids exceeding max_map_count. Leave a
> +         * fixed amount for non-coroutine users like library dependencies,
> +         * vhost-user, etc. Each coroutine takes up 2 VMAs so halve the
> +         * remaining amount.
>           */
> -        return max_map_count / 4;
> +        if (max_map_count > 5000) {
> +            return (max_map_count - 5000) / 2;
> +        } else {
> +            /* Disable the global pool but threads still have local pools */
> +            return 0;
> +        }
>      }
>  #endif

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2024-03-21 10:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 18:12 [PATCH] coroutine: reserve 5,000 mappings Stefan Hajnoczi
2024-03-21 10:43 ` Daniel P. Berrangé [this message]
2024-03-21 17:15 ` Stefan Hajnoczi

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=ZfwPUtYHSJpLJz1l@redhat.com \
    --to=berrange@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).