public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: David Luyer <david_luyer@pacific.net.au>,
	linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@transmeta.com>,
	"David S. Miller" <davem@redhat.com>
Subject: Re: /proc/<n>/maps growing...
Date: Mon, 6 Aug 2001 07:16:59 -0400	[thread overview]
Message-ID: <20010806071659.K3862@devserv.devel.redhat.com> (raw)
In-Reply-To: <997080081.3938.28.camel@typhaon> <20010806105904.A28792@athlon.random> <20010806063003.H3862@devserv.devel.redhat.com> <20010806124952.G15925@athlon.random>
In-Reply-To: <20010806124952.G15925@athlon.random>; from andrea@suse.de on Mon, Aug 06, 2001 at 12:49:52PM +0200

On Mon, Aug 06, 2001 at 12:49:52PM +0200, Andrea Arcangeli wrote:
> I never noticed this limit and personally I don't like it regardless of
> the merge_segments (but of course without merge_segments it is can
> trigger problems while switching between 2.2 and 2.4).

Note that mprotect has this behaviour even if the mprotect range covers the
area before it, so unless the heap is allocated without PROT_NONE initially
with mprotect calls later, there isn't anything glibc can do to avoid this.

The program below creates 3 times 10 new vma areas:

#include <sys/mman.h>
#include <unistd.h>
#include <stdio.h>

int main(void)
{
  void *p, *q, *r;
  p = mmap(NULL, 10*4096, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0);
  printf ("p %p\n", p);
  mprotect(p+1*4096, 4096, PROT_READ|PROT_WRITE);
  mprotect(p+2*4096, 4096, PROT_READ|PROT_WRITE);
  mprotect(p+3*4096, 4096, PROT_READ|PROT_WRITE);
  mprotect(p+4*4096, 4096, PROT_READ|PROT_WRITE);
  mprotect(p+5*4096, 4096, PROT_READ|PROT_WRITE);
  mprotect(p+6*4096, 4096, PROT_READ|PROT_WRITE);
  mprotect(p+7*4096, 4096, PROT_READ|PROT_WRITE);
  mprotect(p+8*4096, 4096, PROT_READ|PROT_WRITE);
  q = mmap(NULL, 10*4096, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0);
  printf ("q %p\n", q);
  mprotect(q+1*4096, 4096, PROT_READ|PROT_WRITE);
  mprotect(q+1*4096, 8192, PROT_READ|PROT_WRITE);
  mprotect(q+2*4096, 8192, PROT_READ|PROT_WRITE);
  mprotect(q+3*4096, 8192, PROT_READ|PROT_WRITE);
  mprotect(q+4*4096, 8192, PROT_READ|PROT_WRITE);
  mprotect(q+5*4096, 8192, PROT_READ|PROT_WRITE);
  mprotect(q+6*4096, 8192, PROT_READ|PROT_WRITE);
  mprotect(q+7*4096, 8192, PROT_READ|PROT_WRITE);
  r = mmap(NULL, 10*4096, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0);
  printf ("r %p\n", r);
  mprotect(r+4096, 1*4096, PROT_READ|PROT_WRITE);
  mprotect(r+4096, 2*4096, PROT_READ|PROT_WRITE);
  mprotect(r+4096, 3*4096, PROT_READ|PROT_WRITE);
  mprotect(r+4096, 4*4096, PROT_READ|PROT_WRITE);
  mprotect(r+4096, 5*4096, PROT_READ|PROT_WRITE);
  mprotect(r+4096, 6*4096, PROT_READ|PROT_WRITE);
  mprotect(r+4096, 7*4096, PROT_READ|PROT_WRITE);
  mprotect(r+4096, 8*4096, PROT_READ|PROT_WRITE);
  fflush(stdout);
  pause();
  return 0;
}

	Jakub

  parent reply	other threads:[~2001-08-06 11:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-06  6:41 /proc/<n>/maps growing David Luyer
2001-08-06  7:43 ` Chris Wedgwood
2001-08-06  8:59 ` Andrea Arcangeli
2001-08-06  9:20   ` David S. Miller
2001-08-06  9:46     ` Chris Wedgwood
2001-08-06 10:57     ` Andrea Arcangeli
2001-08-06 12:26       ` Chris Wedgwood
2001-08-06 12:36         ` Andrea Arcangeli
2001-08-06 12:45           ` Chris Wedgwood
2001-08-06 12:50             ` Andrea Arcangeli
2001-08-06 13:06               ` David S. Miller
2001-08-06 13:29                 ` Andrea Arcangeli
2001-08-06 17:27                   ` Linus Torvalds
2001-09-03 15:44                     ` mmap-rb-7 [was Re: /proc/<n>/maps growing...] Andrea Arcangeli
2001-08-06 17:20           ` /proc/<n>/maps growing Linus Torvalds
2001-08-07  2:24             ` David Luyer
2001-08-06 17:46           ` Anton Altaparmakov
2001-08-06 16:12     ` Rik van Riel
2001-08-06 17:46       ` Linus Torvalds
2001-08-06 10:30   ` Jakub Jelinek
2001-08-06 10:49     ` Andrea Arcangeli
2001-08-06 11:01       ` Jakub Jelinek
2001-08-06 11:25         ` Andrea Arcangeli
2001-08-06 17:17         ` Linus Torvalds
2001-08-06 17:26           ` Alan Cox
2001-08-06 22:55             ` Chris Wedgwood
2001-08-06 11:16       ` Jakub Jelinek [this message]
2001-08-06 17:18       ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2001-08-07  3:46 Rick Hohensee

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=20010806071659.K3862@devserv.devel.redhat.com \
    --to=jakub@redhat.com \
    --cc=andrea@suse.de \
    --cc=davem@redhat.com \
    --cc=david_luyer@pacific.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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