delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/05/11/09:42:58

From: Martin Stromberg <Martin DOT Stromberg AT lu DOT erisoft DOT se>
Message-Id: <200005111438.QAA05671@lws256.lu.erisoft.se>
Subject: Re: Perfomance of gc-simple
To: djgpp-workers AT delorie DOT com
Date: Thu, 11 May 2000 16:38:51 +0200 (MET DST)
In-Reply-To: <200005111326.JAA13160@indy.delorie.com> from "Eli Zaretskii" at May 11, 2000 09:26:59 AM
X-Mailer: ELM [version 2.5 PL3]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Btw, how is this implemented on Unix/Linux?  Here's the relevant
> fragment from the test program run by Grep's configure script:
> 
>     fd = open("conftestmmap", O_RDWR);
>     if (fd < 0)
> 	exit(1);
>     data2 = malloc(2 * pagesize);
>     if (!data2)
> 	exit(1);
>     data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
>     if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
> 		      MAP_PRIVATE | MAP_FIXED, fd, 0L))
> 	exit(1);
> 
> This expects mmap to return the same address as malloc did (modulo the
> alignment).  Since, as DJ explained, mmap uses specially-mapped memory
> that can be grown at will without relocating, does this mean that mmap
> has to fiddle with the page tables to move the buffer to another
> physical address while keeping its logical address unchanged?

But Solaris' man page says:
"The use of MAP_FIXED is discouraged, as it may prevent an
implementation from making the most effective use of system
resources."

I also saw a similar statement on Linux.

So it's strange that a test for mmap() uses a feature that is
discouraged!



Right,

							MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019