> ### Summary
> `os::committed_in_range` is used by NMT to account for thread stacks. The 
> name is misleading, it actually is meant to find **live** pages not just 
> **committed** pages.  On POSIX (except AIX) this works correctly using 
> `mincore`. On Windows this worked incorrectly using `VirtualQuery` (only 
> finds committed, not live regions). This means that the values reported on 
> Windows were inaccurate.
> 
> This PR fixes the Windows implementation by using `QueryWorkingSetEx` instead 
> of `VirtualQuery`. This properly identifies pages that are truly live in the 
> working set, not just committed.  I also renamed `committed_in_range` to 
> `live_in_range` so that the intention is clearer. I have tried to structure 
> the Windows implementation as similarly to Posix as possible to help with 
> maintainability. 
> 
> ### Testing
> - Tested on windows and linux and64
> - `make test TEST=gtest:NMTCommittedVirtualMemory`  (this tests 
> `live_in_range` directly)
> - `make test 
> TEST=test/hotspot/jtreg/runtime/Thread/TestAlwaysPreTouchStacks.java` (this 
> tests `live_in_range` indirectly through NMT thread stack accounting)
> - `make test TEST=gtest:os`
> - `make test TEST=hotspot_nmt`
> - tier 1
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Robert Toyonaga has updated the pull request incrementally with one additional 
commit since the last revision:

  renaming and fix uintx type

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/31124/files
  - new: https://git.openjdk.org/jdk/pull/31124/files/8574fbe3..a8167e02

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=31124&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=31124&range=00-01

  Stats: 64 lines in 5 files changed: 0 ins; 0 del; 64 mod
  Patch: https://git.openjdk.org/jdk/pull/31124.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31124/head:pull/31124

PR: https://git.openjdk.org/jdk/pull/31124

Reply via email to