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

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


On Fri, 15 Jan 2021 11:09:28 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

>> Marcus G K Williams has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 23 commits:
>> 
>>  - Merge branch 'master' into update_hlp
>>  - Merge branch 'master' into update_hlp
>>  - Remove extraneous ' from warning
>>    
>>    Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
>>  - Merge branch 'master' into update_hlp
>>  - Merge branch 'master' into update_hlp
>>  - Merge branch 'master' into update_hlp
>>  - Fix os::large_page_size() in last update
>>    
>>    Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
>>  - Ivan W. Requested Changes
>>    
>>    Removed os::Linux::select_large_page_size and
>>    use os::page_size_for_region instead
>>    
>>    Removed Linux::find_large_page_size and use
>>    register_large_page_sizes. Streamlined
>>    Linux::setup_large_page_size
>>    
>>    Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
>>  - Fix space format, use Linux:: for local func.
>>    
>>    Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
>>  - Merge branch 'update_hlp' of github.com:mgkwill/jdk into update_hlp
>>  - ... and 13 more: https://git.openjdk.java.net/jdk/compare/da2415fe...d73e7a4c
>
> src/hotspot/os/linux/os_linux.cpp line 4013:
> 
>> 4011:   assert(UseLargePages && UseHugeTLBFS, "only for Huge TLBFS large pages");
>> 4012:   assert(is_aligned(bytes, large_page_size), "Unaligned size");
>> 4013:   assert(is_aligned(req_addr, large_page_size), "Unaligned address");
> 
> Adding an assert here that `large_page_size` is larger than os::vm_page_size (small page size) to ensure we actually get a large page size from `page_size_for_region_aligned()`. Otherwise the passed in a size wasn't correctly aligned.

@kstefanj 
Hmm.

`os::page_size_for_region_xxx` can return any page size, including the base page size. Caller may reasonably pass in any reserve size; we may run on a system where the only large page available is > caller size, or we specified LargePageSizeInBytes=1G.

I actually would prefer this function to graciously handle the case of too small input size and just allocate whatever fits the caller size best; if its only 4K pages so be it. But this also could be done in a future RFE.

> src/hotspot/os/linux/os_linux.cpp line 4046:
> 
>> 4044:   // Select large_page_size from _page_sizes
>> 4045:   // that is smaller than size_t bytes
>> 4046:   size_t large_page_size = os::page_size_for_region_aligned(bytes, 1);
> 
> This one also needs to use `os::page_size_for_region_unaligned(...)` since we know we have a size that needs both small and large pages.

+1 to what stefan wrote

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

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


More information about the hotspot-dev mailing list