public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Zack Weinberg" <zackw@stanford.edu>
To: linux-kernel@vger.kernel.org
Cc: Kevin Buhr <buhr@stat.wisc.edu>
Subject: Re: Linux 2.4.2 fails to merge mmap areas, 700% slowdown.
Date: Fri, 23 Mar 2001 20:11:22 -0800	[thread overview]
Message-ID: <20010323201122.Y699@stanford.edu> (raw)
In-Reply-To: <vbawv9hyuj0.fsf@mozart.stat.wisc.edu>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 2573 bytes --]

Kevin Buhr wrote:
> Jakob Østergaard <jakob@unthought.net> writes:
> >
> > Try compiling something like Qt/KDE/gtk-- which are really heavy on
> > templates (with all the benefits and drawbacks of that).
> 
> Okay, I just compiled gtk-- 1.0.3 (with CFLAGS = "-O2 -g") under three
> versions of GCC (Debian 2.95.3, RedHat 2.96, and a CVS pull of the
> "gcc-3_0-branch") on the same Debian machine running kernel 2.4.2.
> 
> In all cases, the "cc1plus" processes appeared to max out around 25M
> total size. The "maps" pseudofiles for the 2.95.3 and and 3.0
> compiles never grew past 250 lines, but the "maps" pseudofiles for the
> RedHat 2.96 compile were gigantic, jumping to 3000 or 5000 lines at
> times.
> 
> The results speak for themselves:
> 
>     CVS gcc 3.0:	Debian gcc 2.95.3:	RedHat gcc 2.96:
>                       
>     real 16m8.423s	real 8m2.417s		real 12m24.939s
>     user 15m23.710s	user 7m22.200s		user 10m14.420s
>     sys 0m48.730s	sys 0m41.040s		sys 2m13.910s
> maps: <250 lines	<250 lines		>3000 lines

Let me inject some information about what gcc's doing in each version.

2.95.3 allocates its memory via a bunch of 'obstacks' which,
underneath, get memory from malloc, and therefore brk(2).  I'm very
surprised to see it had ~250 vmas; it should be more like 10.

2.96 and later versions use a garbage collecting allocator instead; it
was becoming much too hard to decide which obstack to use when.  The
garbage collector allocates memory with mmap(..., MAP_ANON, ...).
This is to avoid interfering with malloc, which is still used in many
places; and to get page-aligned memory without wasting tons of space,
as valloc(3) does.

In Red Hat's 2.96, that allocator gets memory from mmap one page at a
time.  If I understand what's going on in the kernel correctly, that
means each page is its own vma.  25 megs of GC arena is roughly 6400
vmas in that regime.

In CVS 3.0-to-be (and trunk), the allocator gets memory in 32-page
chunks instead.  So 25 megs of GC arena is only 200 vmas.

However, 25 megs of GC arena is small as these things go.  GCC's
memory consumption can _easily_ get up to 200 or 300 megs.  The
example I'm familiar with is insn-attrtab.c from GCC's own sources
(it's machine-generated code, with several huge functions).  256 megs
of GC arena, in 32-page chunks, is 2048 vmas.  Yes, at this point the
machine is swapping... but if I understand the issue, it's just when
we're swapping that having thousands of vmas causes problems.

In conclusion, I think that GCC's allocator still makes a good case
for merging vmas.

zw

  reply	other threads:[~2001-03-24  4:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-20 18:28 Linux 2.4.2 fails to merge mmap areas, 700% slowdown Serge Orlov
2001-03-20 18:43 ` Linus Torvalds
2001-03-20 18:59   ` Jakob Østergaard
2001-03-21  1:20   ` Kevin Buhr
2001-03-21  1:38     ` David S. Miller
2001-03-21 20:19       ` Kevin Buhr
2001-03-22 18:23         ` Kevin Buhr
2001-03-22 18:35           ` Jakob Østergaard
2001-03-23  4:32             ` Kevin Buhr
2001-03-24  4:11               ` Zack Weinberg [this message]
2001-03-24 21:46                 ` Kevin Buhr
2001-03-24  5:02               ` Linus Torvalds
2001-03-24  9:31                 ` Jakob Østergaard
2001-03-24  9:48               ` Jakob Østergaard
2001-03-24 19:54                 ` Kevin Buhr
2001-03-25  3:17                   ` Jakob Østergaard
2001-03-25 16:47                     ` Jamie Lokier
     [not found]               ` <200103240502.VAA02673@penguin.transmeta.com>
2001-03-24 21:22                 ` Kevin Buhr
2001-03-25  3:37                   ` Linus Torvalds
2001-03-26  4:22                     ` Kevin Buhr
2001-03-23 20:43             ` James Lewis Nance
2001-03-21  6:41     ` Mike Galbraith
2001-03-21 14:56       ` Matthias Urlichs
2001-03-21 15:05         ` Mike Galbraith
2001-03-21 15:59       ` Kurt Garloff
2001-03-21 16:45         ` Mike Galbraith
2001-03-21 20:16           ` Kevin Buhr
2001-03-22  9:04             ` Mike Galbraith
2001-03-22 22:19               ` Kevin Buhr
2001-03-23  7:44                 ` Mike Galbraith
2001-03-23 21:36                   ` 2.4.2-ac20 patch for process time double-counting (was: Linux 2.4.2 fails to merge mmap areas, 700% slowdown.) Kevin Buhr
2001-03-24  7:49                     ` Mike Galbraith
2001-03-24 19:27                       ` Kevin Buhr
2001-03-20 18:43 ` Linux 2.4.2 fails to merge mmap areas, 700% slowdown Jakob Østergaard
  -- strict thread matches above, loose matches on Subject: below --
2001-03-21  2:02 Dieter Nützel

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=20010323201122.Y699@stanford.edu \
    --to=zackw@stanford.edu \
    --cc=buhr@stat.wisc.edu \
    --cc=linux-kernel@vger.kernel.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