From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 7A41A385DC1A; Tue, 7 Apr 2020 16:24:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A41A385DC1A Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: mmap_alloc: fix comment to document using the extended memory API X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: b8ecbaaac0f9ff9682a310cc78616d421470335e X-Git-Newrev: 3fe9b02ccd6aeb684e39ca3fb9a6fd3ee5ede852 Message-Id: <20200407162453.7A41A385DC1A@sourceware.org> Date: Tue, 7 Apr 2020 16:24:53 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 16:24:53 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3fe9b02ccd6aeb684e39ca3fb9a6fd3ee5ede852 commit 3fe9b02ccd6aeb684e39ca3fb9a6fd3ee5ede852 Author: Corinna Vinschen Date: Tue Apr 7 14:17:04 2020 +0200 Cygwin: mmap_alloc: fix comment to document using the extended memory API Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/mmap_alloc.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/mmap_alloc.cc b/winsup/cygwin/mmap_alloc.cc index b42bc16e1..cd4d49bc9 100644 --- a/winsup/cygwin/mmap_alloc.cc +++ b/winsup/cygwin/mmap_alloc.cc @@ -4,17 +4,20 @@ #include "mmap_alloc.h" #include -/* FIXME? Unfortunately the OS doesn't support a top down allocation with - a ceiling value. The ZeroBits mechanism only works for - NtMapViewOfSection and it only evaluates the high bit of ZeroBits - on 64 bit, so it's pretty much useless for our purposes. +/* Starting with Windows 10 1803 we use VirtualAlloc2 and MapViewOfFile3 + (or rather NtMapViewOfSectionEx), rather than the below class. + + Up to Windows 10 1709, the OS doesn't support a top down allocation with + a ceiling value. The ZeroBits mechanism only works for NtMapViewOfSection + and it only evaluates the high bit of ZeroBits on 64 bit, so it's pretty + much useless for our purposes. + + If the below simple mechanism to perform top-down allocations turns out to + be too dumb, we need something else. One idea is to divide the space in + (3835) 4 Gig chunks and just store the available free space per slot. Then + we can go top down from slot to slot and only try slots which are supposed + to have enough space. Bookkeeping would be very simple and fast. */ - If the below simple mechanism to perform top-down allocations - turns out to be too dumb, we need something else. One idea is to - dived the space in (3835) 4 Gig chunks and simply store the - available free space per slot. Then we can go top down from slot - to slot and only try slots which are supposed to have enough space. - Bookkeeping would be very simple and fast. */ PVOID mmap_allocator::alloc (PVOID in_addr, SIZE_T in_size, bool fixed) {