qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Andreas Schwab <schwab@suse.de>, qemu-devel@nongnu.org
Subject: Re: qemu-x86_64 runs out of memory
Date: Tue, 13 Sep 2022 11:53:22 +0100	[thread overview]
Message-ID: <c16ba95c-6a97-92cd-ee01-67f5fd0a65ff@linaro.org> (raw)
In-Reply-To: <mvmczbzty5j.fsf@suse.de>

On 9/13/22 10:35, Andreas Schwab wrote:
> $ cat mmap.c
> #include <stdio.h>
> #include <sys/mman.h>
> 
> int
> main (void)
> {
>    void *A;
>    size_t L = 0, U, Max = 0;
>    for (U = 1; ; U *= 2)
>      {
>        A = mmap (0, U, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
>        if (A == (void *) -1)
> 	break;
>        else
> 	munmap (A, U);
>      }
>    while (L + 1 < U)
>      {
>        size_t M = L + (U - L) / 2;
>        A = mmap (0, M, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
>        if (A == (void *) -1)
> 	U = M;
>        else
> 	{
> 	  Max = M;
> 	  munmap(A, M);
> 	  L = M;
> 	}
>      }
>    printf ("%zx\n", Max);
> }
> $ cc -O2 -g -Wall -std=gnu11 -g     mmap.c   -o mmap
> $ ./mmap
> 7f672e5ff000
> $ qemu-x86_64 ./mmap
> Killed
> 

I suspect this is the same as

   https://gitlab.com/qemu-project/qemu/-/issues/290

Needs a reorg of memory region tracking for {linux,bsd}-user.


r~


  reply	other threads:[~2022-09-13 10:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13  9:35 qemu-x86_64 runs out of memory Andreas Schwab
2022-09-13 10:53 ` Richard Henderson [this message]
2022-09-26 11:39   ` Li Zhang
2022-09-13 14:33 ` Alex Bennée

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=c16ba95c-6a97-92cd-ee01-67f5fd0a65ff@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=schwab@suse.de \
    /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).