RFR: 8256155: Allow multiple large page sizes to be used on Linux [v34]

Stefan Johansson sjohanss at openjdk.java.net
Wed May 12 21:48:01 UTC 2021


On Wed, 12 May 2021 20:22:17 GMT, Marcus G K Williams <mgkwill at openjdk.org> wrote:

>> src/hotspot/os/linux/os_linux.cpp line 3789:
>> 
>>> 3787:       break;
>>> 3788:     }
>>> 3789:   }
>> 
>>> While doing some manual testing I found a problem when setting `LargePageSizeInBytes=1g`, but without having any 1g pages configured. In that case, we will turn off `UseLargePages` even if there are 2m pages configured.
>>> 
>>> Not sure if we should address this as part of this change or as a follow up, but I think the `hugetlbfs_sanity_check(...)` should check that at least one of the supported large pages are configured, not just the one set as the maximum large page size.
>> 
>> @kstefanj How about this as a solution?
>
> Or perhaps we could do the following, if passing in each large_page size will affect shm etc.
>  (os_linux.cpp at 3674):
> 
> 
>   if (UseHugeTLBFS) {
>     bool warn_on_failure = !FLAG_IS_DEFAULT(UseHugeTLBFS);
>     for (size_t large_page_size = page_size; large_page_size != (size_t)os::vm_page_size();
>          large_page_size = _page_sizes.next_smaller(large_page_size)) {
>       if (hugetlbfs_sanity_check(warn_on_failure, large_page_size)) {
>         UseSHM = false;
>         return true;
>       }
>     }
>     UseHugeTLBFS = false;
>   }
> 
> instead of:
> ``` 
>   if (UseHugeTLBFS) {
>     bool warn_on_failure = !FLAG_IS_DEFAULT(UseHugeTLBFS);
>     if (hugetlbfs_sanity_check(warn_on_failure, page_size)) {
>       UseSHM = false;
>       return true;
>     }
>     UseHugeTLBFS = false;
>   }

I was thinking something like the latter. Possibly keeping the call as is, but in `hugetlbfs_sanity_check(...)` keep checking smaller large page sizes if the passed in doesn't pass the test. Doing so, we could add debug/info-logging if the requested page_size doesn't pass the check.

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

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



More information about the hotspot-gc-dev mailing list