On Thu, 24 Aug 2023 23:31:56 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

> On some macosx-aarch64 systems, not all mapped pages are dumped to the core 
> file. This first turned up with 
> [JDK-8293563](https://bugs.openjdk.org/browse/JDK-8293563) where large parts 
> of the ZGC heap would not be in the core file, leading to various SA address 
> errors. For JDK-8293563 the issue was addressed by having the core file test 
> always use `-XX:+AlwaysPreTouch` on macosx-aarch64. This seemed to force the 
> ZGC pages to always end up in the core file.
> 
> A similar issue has been noticed with mapped in pages of the CDS archive. We 
> are seeing cases where SA references to addresses that are clearly in the CDS 
> archive (based on info in the hs_err file) are failing to be read from the 
> core file by SA. This problem has turned up a number of times during CI 
> testing, but I have yet to be able to reproduce it myself. This PR is an 
> attempt to address this testing issue by having the CDS archive also pretouch 
> all mapped in pages when `-XX:+AlwaysPreTouch` is used.
> 
> Tested with tier1 and tier3 and also ran the test about 5,000 times with and 
> without the fix. It never reproduced for either. Hopefully the problem is 
> gone with this fix, but it may take a few months of CI testing before we can 
> be confident it is fixed.

As `AlwaysPreTouch` is false by default, and we don't explicitly turn it on for 
CI testing, what tests will actually be affected by this change?  And for 
applications that already enable `AlwaysPreTouch` (would they?) what impact 
might this have e.g. on startup?

Thanks

src/hotspot/share/cds/filemap.cpp line 1694:

> 1692:   if (AlwaysPreTouch) {
> 1693:     read_only = false;
> 1694:   }

Nit: you can handle this more succinctly by simply doing:

 char* mem = os::map_memory(fd, file_name, file_offset, addr, bytes,
                            AlwaysPreTouch ? false : read_only, allow_exec, 
flags);

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

PR Review: https://git.openjdk.org/jdk/pull/15423#pullrequestreview-1594743641
PR Review Comment: https://git.openjdk.org/jdk/pull/15423#discussion_r1305070055

Reply via email to