RFR: 8315923: pretouch_memory by atomic-add-0 fragments huge pages unexpectedly [v22]

Liming Liu duke at openjdk.org
Fri Jan 12 08:20:03 UTC 2024


On Fri, 20 Oct 2023 05:41:35 GMT, Liming Liu <duke at openjdk.org> wrote:

>> src/hotspot/os/linux/os_linux.cpp line 2911:
>> 
>>> 2909:   if (::madvise(first, len, MADV_POPULATE_WRITE) == -1) {
>>> 2910:     int err = errno;
>>> 2911:     if (err == EINVAL) { // Not supported
>> 
>> Would be nice to avoid repeated syscalls to madvise if this fails once; no reason to try again, then.
>
> I tested the performance of this patch on kernel 4.18 and 5.13, and found the repeat calls have no impact. So I would not change anything about this.

It seems that a thread-local variable is cheap for recording whether madvise once failed, but os::Linux does not have a thread-local variable yet. Is it okay to have a thread-local variable for this?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15781#discussion_r1450017874


More information about the hotspot-runtime-dev mailing list