RFR: 8315923: pretouch_memory by atomic-add-0 fragments huge pages unexpectedly
Johan Sjölen
jsjolen at openjdk.org
Mon Oct 2 10:26:51 UTC 2023
On Tue, 19 Sep 2023 09:22:46 GMT, Liming Liu <duke at openjdk.org> wrote:
>> src/hotspot/os/linux/os_linux.cpp line 2914:
>>
>>> 2912: // will initially always use small pages.
>>> 2913: page_size = UseTransparentHugePages ? (size_t)os::vm_page_size() : page_size;
>>> 2914: pretouch_memory_fallback(start, end, page_size);
>>
>> This assignment should be to a new variable named `pretouch_page_size` since it will only be used by `pretouch_memory_fallback`, and otherwise modifies the function parameter and also shadows the variable from `class os`. Declaring it `const` would get you extra points from readers, but I accept that is not the style here.
>
> The code is moved from the Linux-specific code in pretouchTask.cpp. I think it would be fine here.
The moved code was from a `#ifdef` block, which is why the overwriting of `page_size` was done. I prefer Peter's style suggestion of declaring a new `const` variable.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15781#discussion_r1342514403
More information about the hotspot-runtime-dev
mailing list