Skip to content

8386546: Fix race when reserving memory with NUMA interleaving on Windows#31507

Draft
roberttoyonaga wants to merge 1 commit into
openjdk:masterfrom
roberttoyonaga:VA2-part2
Draft

8386546: Fix race when reserving memory with NUMA interleaving on Windows#31507
roberttoyonaga wants to merge 1 commit into
openjdk:masterfrom
roberttoyonaga:VA2-part2

Conversation

@roberttoyonaga

@roberttoyonaga roberttoyonaga commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Previously on Windows Hotspot used the following race-y pattern to reserve a virtual memory region and divide it up among NUMA nodes:

  • Reserve a large region in order to get an available address range.
  • Release the entire range
  • Quickly re-reserve subregions within the original region (assigning each to a round robin of NUMA nodes).
    See allocate_pages_individually.

VirtualAlloc2 (available since Windows version 1803) removes the need for this race-y code by introducing "placeholders". Placeholders allow for reserving regions, and later splitting them up while still holding the reservation.

This is a scoped-down version of JDK-8376561 and #30270 limited to the changes required to eliminate the NUMA race. This is the 2nd change in a series of changes that take advantage of VirtualAlloc2 to replace races in Windows code. The preceding change was JDK-8385586.

Divergences from JDK-8376561 / #30270 :

  1. The os:: Placeholder API has been moved into os::win32:: in order to constrain the scope of changes to Windows code only.
  2. Tests have been moved from test_os.cpp to test_os_windows.cpp

Notes

reserve_placeholder_memory, split_memory, and convert_to_reserved could have been made internal helper functions in os_windows.cpp. However, I added them to os::win32:: so that they could be unit tested better.

Testing:

  • Added new tests to os_windows.cpp
  • make test TEST=gtest:os
  • Tier 1
    Tested locally on Windows.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8386546: Fix race when reserving memory with NUMA interleaving on Windows (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31507/head:pull/31507
$ git checkout pull/31507

Update a local copy of the PR:
$ git checkout pull/31507
$ git pull https://git.openjdk.org/jdk.git pull/31507/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 31507

View PR using the GUI difftool:
$ git pr show -t 31507

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31507.diff

@bridgekeeper

bridgekeeper Bot commented Jun 12, 2026

Copy link
Copy Markdown

👋 Welcome back roberttoyonaga! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk

openjdk Bot commented Jun 12, 2026

Copy link
Copy Markdown

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot changed the title 8386546 8386546: Fix race when reserving memory with NUMA interleaving on Windows Jun 12, 2026
@openjdk openjdk Bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Jun 12, 2026
@openjdk

openjdk Bot commented Jun 12, 2026

Copy link
Copy Markdown

@roberttoyonaga The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk

openjdk Bot commented Jun 12, 2026

Copy link
Copy Markdown

The total number of required reviews for this PR has been set to 2 based on the presence of this label: hotspot-runtime. This can be overridden with the /reviewers command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-runtime hotspot-runtime-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

1 participant