RFR: JDK-8256287: [windows] add loop fuse to map_or_reserve_memory_aligned [v2]

Thomas Stuefe stuefe at openjdk.java.net
Mon Nov 16 12:24:07 UTC 2020


> Hi,
> 
> may I please have reviews for this little fix:
> 
> On windows, `map_or_reserve_memory_aligned()` attempts to allocate aligned memory by:
> 1) reserving larger area
> 2) releasing it
> 3) attempting to re-reserve into the vacated address space a smaller area at the aligned start address
> 
> Since this may fail (between (2) and (3) someone may have grabbed part of that address space concurrently), we do this in a loop. However, when failing to release it we will loop-reserve endlessly.
> 
> This is one of the reasons for JDK-8255954 whose root cause will be fixed with JDK-8255978. But we should guard against endless loops independently from that.
> 
> This patch:
> - limits the number we try this to 20. If in 20 cases someone else grabs address space concurrently, something is off...
> - now correctly handles the return code of the release operation (1): in debug we assert, since if release_memory() fails something is wrong and we should take a look. In the release case, we now return an error.
> 
> 
> Thanks!

Thomas Stuefe has updated the pull request incrementally with two additional commits since the last revision:

 - Remove blank before unary ++
 - feedback alexey

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1191/files
  - new: https://git.openjdk.java.net/jdk/pull/1191/files/55486a92..e716a994

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1191&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1191&range=00-01

  Stats: 14 lines in 1 file changed: 2 ins; 2 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1191.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1191/head:pull/1191

PR: https://git.openjdk.java.net/jdk/pull/1191


More information about the hotspot-runtime-dev mailing list