JDK-8261401 : Add sanity check for UseSHM large pages similar to the one used with hugetlb large pages
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-02-09
  • Updated: 2021-03-02
  • Resolved: 2021-02-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b11Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
When large pages are enabled on Linux (using -XX:+UseLargePages), both UseHugeTLBFS and UseSHM can be used. We prefer to use HugeTLBFS and first do a sanity check to see if this kind of large pages are available and if so we disable UseSHM. 

The problematic part is when HugeTLBFS pages are not available, then we disable this flag and without doing any sanity check for UseSHM, we mark large pages as enabled using SHM. The thing with SHM is that it requires the same type of explicitly allocated huge pages as HugeTLBFS and also privileges to lock memory. So it is likely that in the case of not being able to use HugeTLBFS we probably can't use SHM either.

A fix for this would be to do a similar sanity check as currently done for HugeTLBFS and if it fails disable UseLargePages since we will always fail such allocation attempts anyways.
Comments
Changeset: f639df43 Author: Stefan Johansson <sjohanss@openjdk.org> Date: 2021-02-17 12:03:25 +0000 URL: https://git.openjdk.java.net/jdk/commit/f639df43
17-02-2021