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

Liming Liu duke at openjdk.org
Fri Jan 12 06:32:27 UTC 2024


On Thu, 11 Jan 2024 07:53:14 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Liming Liu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use pthread instead
>
> src/hotspot/share/runtime/os.cpp line 2118:
> 
>> 2116:   }
>> 2117: }
>> 2118: 
> 
> I suggest a slightly different flow, similar to how we do things in other areas:
> 
> os.hpp
> 
> 
> private:
> bool pd_pretouch_memory(..);
> public:
> void pretouch_memory(..);
> 
> 
> os.cpp
> 
> void os::pretouch_memory(..) {
>   // Ask platform first
>   if (pd_pretouch_memory(..)) {
>     return;
>   }
>   ... do pretouching by touching
> }
> 
> 
> then provide a pd_pretouch for every platform; let other platforms be just a noop returning false, on Linux - if THPs are enabled and so forth, do the madvise and return true.
> 
> One function less in the os namespace, and we don't call back from a pd_... function into a generic function which is unusual.

Linux requires a different page size for touching when THP is enabled. Should I change page_size to a reference or returns the page size for touching rather than a false?

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

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


More information about the hotspot-dev mailing list