RFR: 8281946: VM.native_memory should report size of shareable memory [v2]
Ioi Lam
iklam at openjdk.org
Mon Dec 5 05:34:56 UTC 2022
On Sat, 3 Dec 2022 08:37:14 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Assert should now pass on windows
>
> src/hotspot/share/services/memReporter.cpp line 121:
>
>> 119: FileMapRegion* r = FileMapInfo::current_info()->region_at(MetaspaceShared::ro);
>> 120: // Region will be read-write on windows, otherwise this is a sanity check
>> 121: if (!MetaspaceShared::use_windows_memory_mapping())
>
> Can be folded into the assert, e.g.
> ```assert(MetaspaceShared::use_windows_memory_mapping() || r->read_only())```
> (otherwise, would need curly brackets)
On Windows, the pages in the CDS archive are not shareable across processes (even the RO region is private to the current JVM process). Therefore, we shouldn't show them as shared. This condition should be changed to:
if (r->read_only()) {
read_only_bytes = r->used();
}
Also, we can have up to two mapped CDS archives. For safety, NULL checks should be done on both:
read_only_bytes = get_read_only_size(FileMapInfo::current_info()); // static archive
read_only_bytes += get_read_only_size(FileMapInfo::dynamic_info()); // dynamic archive
size_t get_read_only_size(FileMapInfo* info) {
if (info != NULL) {
....
}
}
-------------
PR: https://git.openjdk.org/jdk/pull/11401
More information about the hotspot-runtime-dev
mailing list