RFR: 8272807: Permit use of memory concurrent with pretouch

Thomas Stuefe stuefe at openjdk.java.net
Fri Feb 4 12:31:08 UTC 2022


On Fri, 4 Feb 2022 10:47:18 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> [Trying again, after a couple previous proposals.]
> 
> Please review this change to os::pretouch_memory to permit use of the memory
> being pretouched concurrently with the pretouch operation.  This will allow
> future changes that can make use of such overlap.
> 
> Testing:
> mach5 tier1-3 with -XX:+AlwaysPreTouch.
> 
> Verified no performance impact by comparing startup times with Epsilon GC and
> -XX:+AlwaysPretouch on a large enough heap that the pretouch takes a
> significant amount of time.  Tested on both linux-x64 and linux-aarch64.
> 
> None of these test concurrent use; that will wait for future changes that use
> the new feature.

Looks good.

I wondered for a moment if the underlying hardware could optimize something like `xadd mem, r=0` out. Since the effect would not be observable. But it would have to at least return the old memory content. It's probably fine.

A gtest would be nice, but probably difficult to write in a way to reliably show errors without this patch.

src/hotspot/share/runtime/os.cpp line 1759:

> 1757:   assert(is_power_of_2(page_size), "page size misaligned: %zu", page_size);
> 1758:   assert(page_size >= sizeof(int), "page size too small: %zu", page_size);
> 1759:   if (start < end) {

Should we assert start <= end, or maybe even start < end?

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

Marked as reviewed by stuefe (Reviewer).

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


More information about the hotspot-runtime-dev mailing list