RFR: JDK-8256155: os::Linux Populate all large_page_sizes, select smallest page size in reserve_memory_special_huge_tlbfs* [v19]

Thomas Stuefe stuefe at openjdk.java.net
Sat Mar 13 07:38:07 UTC 2021


On Thu, 11 Mar 2021 22:25:28 GMT, Marcus G K Williams <github.com+168222+mgkwill at openjdk.org> wrote:

>> When using LargePageSizeInBytes=1G, os::Linux::reserve_memory_special_huge_tlbfs* cannot select large pages smaller than 1G. Code heap usually uses less than 1G, so currently the code precludes code heap from using
>> Large pages in this circumstance and when os::Linux::reserve_memory_special_huge_tlbfs* is called page sizes fall back to Linux::page_size() (usually 4k).
>> 
>> This change allows the above use case by populating all large_page_sizes present in /sys/kernel/mm/hugepages in _page_sizes upon calling os::Linux::setup_large_page_size().
>> 
>> In os::Linux::reserve_memory_special_huge_tlbfs* we then select the largest large page size available in _page_sizes that is smaller than bytes being reserved.
>
> Marcus G K Williams has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Fix whitespace error
>    
>    Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
>  - Fix first set of TestTracePageSizes.java issues
>    
>    Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>

Hi Markus,

first off, starting to look better and better. 

About the assert, I'm quite sure this is the result of using `os::page_size_for_region_aligned()` - as Stefan mentioned above you should use the unaligned version of this function since the input size 21098496 is not aligned to 2M, which causes the function to return 4K even though we have space enough to fit 9-10 2M pages here:

[0.825s][info][pagesize] Large page size returned from os::page_size_for_region_aligned: 4096, for bytes: 21098496

Sorry, I don't have time to dive deeper. I know @kstefanj had some more ideas and this ties in with his work, but he may be occupied with other things right now and may not be quick to reply. 

All in all this starts to look real good. I try to resist the urge to refactor everything on the back of this PR. There will be work left for future RFEs.

Cheers, Thomas

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

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



More information about the hotspot-gc-dev mailing list