RFR: 8234930: Use MAP_JIT when allocating pages for code cache on macOS
Stefan Karlsson
stefank at openjdk.java.net
Mon Sep 28 11:20:21 UTC 2020
On Mon, 28 Sep 2020 11:16:46 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> Hi Anton,
>>
>> I am sorry, but I dislike the API changes to os::xxx(). As it is now, this API is quite convoluted, undocumented and
>> inconsistent. There are ongoing efforts to clean this up (see eg JDK-8253650, JDK-8253638 and JDK-8253683). This mess
>> carries over into the upper layers too, e.g. ReservedSpace. About the API changes:
>>
>> - Why does os::uncommit_memory() now require "exec" as parameter? I know why you do it, but semantically it has no
>> meaning. I should be able to uncommit memory without knowing the exact flags the mapping had been established with. So
>> now the user has to carry this information and provide it back to the API when uncommitting? Right now probably all
>> uncommits happen in areas where the exec information is implicit by its usage, but who says this is always the case?
>>
>> - We now have to specify "exec" as parameter to os::reverve_memory(). This is another new restriction - before, I could
>> theoretically reserve one mapping and commit various parts of it with and without exec flag. With this change, the
>> whole mapping has to be either exec or !exec.
>> Can we on MacOS not use mmap at os::commit_memory, like we do on other platforms? In os::commit_memory, the exec
>> parameter exists but on MacOS it is ignored. It would be more consistent with other platforms if the exec parameter
>> were honored in commit, not requiring a new one at reserve. And I see mmap is used in uncommit, so changing mappings
>> via overlapped mmap seems to work? Thanks, Thomas
>
>> I am sorry, but I dislike the API changes to os::xxx(). As it is now, this API is quite convoluted, undocumented and
>> inconsistent.
>
> Just to clarify that I did not mean your change makes the API convoluted and inconsistent but that it has been that way
> already, for a long time. It is a constant headache to get right, especially in ports whose memory management is a bit
> non-standard, e.g. on AIX.
@tstuefe My patch to remove MAP_FIXED from the memory reservation path should make it possible to revert all the
os::reserve_memory changes in this patch.
-------------
PR: https://git.openjdk.java.net/jdk/pull/294
More information about the hotspot-gc-dev
mailing list