delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/07/13/11:07:29

X-Spam-Check-By: sourceware.org
Date: Thu, 13 Jul 2006 10:07:27 -0500
From: Brian Ford <Brian DOT Ford AT flightsafety DOT com>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.21s mmap error
In-Reply-To: <20060713103431.GA17383@calimero.vinschen.de>
Message-ID: <Pine.CYG.4.58.0607130933400.1164@PC1163-8460-XP.flightsafety.com>
References: <Pine DOT CYG DOT 4 DOT 58 DOT 0607121030410 DOT 3792 AT PC1163-8460-XP DOT flightsafety DOT com> <20060712165900 DOT GQ8759 AT calimero DOT vinschen DOT de> <Pine DOT CYG DOT 4 DOT 58 DOT 0607121318080 DOT 2284 AT PC1163-8460-XP DOT flightsafety DOT com> <20060712202215 DOT GS8759 AT calimero DOT vinschen DOT de> <Pine DOT CYG DOT 4 DOT 58 DOT 0607121536330 DOT 3784 AT PC1163-8460-XP DOT flightsafety DOT com> <20060713103431 DOT GA17383 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Thu, 13 Jul 2006, Corinna Vinschen wrote:

> I just read the Linux man page (again), and I seem to have missed some
> important bits.  The above semantics are not implemented this way in
> Cygwin.  A private anonymous mmap is actually just an area allocated
> with VirtualAlloc.  A MAP_NORESERVE area is not commited (MEM_COMMIT)
> but just reserved (MEM_RESERVE).  What's missing is the automatic
> commiting when a page fault on one of these pages occurs.

I figured as much based on your previous response, but I wanted to point
out that that was not the typical meaning of MAP_NORESERVE.

> I added an (hopefully) appropriate patch, which commits a page within a
> MAP_NORESERVE area when memory in this page is accessed by the
> application.  If commiting the memory fails, SIGBUS is generated. Please
> test CVS HEAD or the next developer snapshot from
> http://cygwin.com/snapshots/

Wow!  Thanks.  Given my limited Windows API knowledge, that sounded
difficult to accomplish properly.  I'll test it for you shortly.

> Note however, that MAP_NORESERVE is only implemented for private
> anonymous mappings.

I think the private restriction is typical, so...

> Shared anonymous maps seem to be possible (and would probably make sense
> to minimze the swap space footprint), but are somewhat tricky since it's
> not quite clear what happens to memory which is commited in one process
> and then accessed in another.  This would require some extensive testing
> which I'm not willing to do yet.

Huh, what does a shared anonymous (/dev/zero) mapping even mean?  You
can't modify /dev/zero, so the only thing that makes sense to me is that
changes made would be visible by the whole process tree containing the
mapping?  I'm not aware of any OS that supports this.

> File-backed mappings are always ignoring the MAP_NORESERVE flag and are
> using committed memory, since uncommitted file maps are not supported on
> Windows.

That's too bad :-(.  Does the above mean that a private file-backed
mapping consumes the full mapping size of swap space just in case all the
pages are dirtied?  Obviously, the file is the backing store until the
page is written, so there is no extra swap usage then.

BTW, If you haven't already, you might consider transparently changing
/dev/zero mappings to anonymous ones so MAP_NORESERVE is possible there.

Thanks again.

-- 
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...

.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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