public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/50636] GC in large LTO builds cause excessive fragmentation in memory map
Date: Sat, 08 Oct 2011 20:14:00 -0000	[thread overview]
Message-ID: <bug-50636-4-r5yb7etXnL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50636-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50636

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-08 20:14:14 UTC ---
In the 0001-initial-madvise.patch patch I think if you subtract the size
MADV_DONTNEEDed from G.bytes_mapped, then you should add it again in
alloc_page (i.e. replace
+      p->unmapped = false;
+
you've added there with:
+      if (p->unmapped)
+        G.bytes_mapped += p->bytes;
+      p->unmapped = false;
+
Not sure if it is enough as is with that change, or if more is needed - like
also keeping track of the size of currently MADV_DONTNEED bytes and if it grows
too much together with G.bytes_mapped, consider really munmapping some of the
pages (perhaps try to sort the free list by increasing size, so that further
allocations will prefer the smaller blocks over the larger ones, and if getting
close to filled address space, consider freeing some of the largest one in case
malloc would be requested.  Or alternatively, hook into xmalloc_failed and if
malloc fails, try to free some of the largest chunks and retry.  I'm just
worried if at some point during the compilation we need huge amount of GC
memory, close to filling 32-bit address space, then we GC collect lots of it,
but on the other side would need a lot of malloced memory.  But perhaps that is
unlikely to happen.


  parent reply	other threads:[~2011-10-08 20:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06 18:21 [Bug other/50636] New: " andi-gcc at firstfloor dot org
2011-10-06 19:20 ` Jan Hubicka
2011-10-06 19:21 ` [Bug other/50636] " hubicka at ucw dot cz
2011-10-06 21:29 ` jakub at gcc dot gnu.org
2011-10-06 21:32 ` andi-gcc at firstfloor dot org
2011-10-06 21:42 ` jakub at gcc dot gnu.org
2011-10-06 21:47 ` andi-gcc at firstfloor dot org
2011-10-07  5:49 ` andi-gcc at firstfloor dot org
2011-10-07  5:51 ` andi-gcc at firstfloor dot org
2011-10-07  8:25 ` rguenth at gcc dot gnu.org
2011-10-07 10:01 ` jakub at gcc dot gnu.org
2011-10-07 14:45 ` andi-gcc at firstfloor dot org
2011-10-08 16:48 ` andi-gcc at firstfloor dot org
2011-10-08 19:55 ` andi-gcc at firstfloor dot org
2011-10-08 20:14 ` jakub at gcc dot gnu.org [this message]
2011-10-08 21:10 ` andi-gcc at firstfloor dot org
2011-10-17 14:44 ` ak at gcc dot gnu.org
2011-10-20  0:11 ` andi-gcc at firstfloor dot org

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=bug-50636-4-r5yb7etXnL@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).