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

Stefan Johansson sjohanss at openjdk.java.net
Tue May 18 10:39:52 UTC 2021


On Tue, 18 May 2021 06:16:39 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/os/linux/os_linux.cpp line 3751:
>> 
>>> 3749:     UseTransparentHugePages = false;
>>> 3750:     UseHugeTLBFS = false;
>>> 3751:     UseSHM = false;
>> 
>> Suggestion:
>> 
>>     UseSHM = false;
>>     if (!FLAG_IS_DEFAULT(UseLargePages)) {
>>       log_warning(pagesize)("UseLargePages disabled, no large pages configured and available on the system.");
>>     }
>>     UseLargePages = false;
>
> @mgkwill Okay, that lcm assert has been embarrassingly easy to reproduce and fix (even on x64, by just setting default_large_page_size to 0). Suggested change above.
> 
> Slight beauty spot here is that we have now the large page warning spread over two places. Maybe you or @kstefanj have a better proposal. Ideally, we would
> - scan default large page
> - scan available page sizes
> - if no default large page or no multiple page sizes or multiple page sizes do not contain default large page, bail out with error.
> But I remember we were not sure if the default large page could possibly be missing from the set of large page sizes, so we correct the value further down.
> 
> So, it had nothing to do with 64k. Actually I remember trying to fake it once but since the page size goes into the alignment for committing memory, this is not so easy (we fake it on AIX because of complicated boring reasons, but there we have implicit commit on touch).
> 
> Sorry for the 64k wild goose chase.
> 
> Cheers, Thomas

This part of the init-step is new, before we did not treat a default large page size equal to zero to be a specific problem. It was caught later by the sanity-checks if I'm not mistaken. I wonder if we could do the same now, but I kind of like this being treated separately. 

One thing we could do to make this a little nicer is to add a function:

void warn_no_large_pages_configured() {
  if (!FLAG_IS_DEFAULT(UseLargePages)) {
    log_warning(pagesize)("UseLargePages disabled, no large pages configured and available on the system.");
  }
}

We could then call that function from both here: 

if (default_large_page_size == 0) {
  // No large pages configured, return.
  warn_no_large_pages_configured();
  UseLargePages = false;
  UseTransparentHugePages = false;
  UseHugeTLBFS = false;
  UseSHM = false;
}

And at the end of `setup_large_page_type()`:

  ...
  warn_no_large_pages_configured();
  return false;
}

What do you guys think about that @tstuefe and @mgkwill?

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

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



More information about the hotspot-gc-dev mailing list