Linux, hugetlbfs, UseSHM removal?

Andrew Haley aph-open at littlepinkcloud.com
Mon Jun 26 11:28:01 UTC 2023


On 6/23/23 13:11, Thomas Stüfe wrote:
> Hi all,
> 
> We talked about this [1] and StefanJ opened an issue open for it [2], and also I had private talks with various people. I am currently digging around in LP initialization again, and getting rid of SHM mode would be so nice. Perfect time for it too, just after LTS fork-off.
> 
> SHM tlbfs mode causes a lot of extra complexity. Since SHM segments can only be detached as a whole, they behave more like Windows VirtualSpace instead of mmap. As in, the whole mapping cannot be split, cannot be partially uncommitted etc. As StefanJ pointed out in [2], it also requires more permissions than mmap-tlbfs mode.
> 
> I have always had the suspicion that this is a dusty corner of hotspot that is rarely used and probably broken in many corner cases. For example, the sanity checks at VM startup are not correctly implemented, see JDK-8310262

Here's the discussion that led to what we have now:

https://mail.openjdk.org/pipermail/hotspot-dev/2011-April/004060.html

Commit 2383:139667d9836a, is credited to

7034464: Support transparent large pages on Linux
Summary: Support transparent huge pages on Linux available since 2.6.38
Reviewed-by: iveresov, ysr
Contributed-by: aph at redhat.com

The SHM was left in because of older systems, and caution, I think.

Also:

 >>> Yes, but on Linux at least +UseLargePages (using all that SHM stuff)
 >>> needs special permissions, so it tends not to be used as much as it
 >>> could.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the hotspot-dev mailing list