Closed lordofpipes closed 4 months ago
Started test build 124261
Build 124261 successful To test this build, install it from the testing repository:
flatpak install --user https://dl.flathub.org/build-repo/107217/org.prismlauncher.PrismLauncher.flatpakref
bot, build
Queued test build for org.prismlauncher.PrismLauncher.
Started test build 126250
Build 126250 successful To test this build, install it from the testing repository:
flatpak install --user https://dl.flathub.org/build-repo/109214/org.prismlauncher.PrismLauncher.flatpakref
Seems to work :D
Closes #61
Java is able to make use of hugepages to greatly reduce pagetable lookups by allowing the process to map larger chunks of RAM at a time. This is known to boost Minecraft performance on both the server and client. The Linux kernel in particular offers transparent hugepages, which allows userspace processes to specify whether they prefer hugepages, without needing root access. In order for Java to detect this, it needs to see the kernel-side switches in
/sys/kernel/mm/transparent_hugepage/
.Because the Flatpak sandboxing restricts access to some parts of
/sys/
, enabling THP in Minecraft results in this error:Thankfully, Java is designed to fallback to non-THP, so adding the flag doesn't cause the user's instances to crash, but it silently disables an option that otherwise could work. The
/sys/
files in question are accessed injdk21u/src/hotspot/os/linux/hugepages.cpp
.These can be exposed as read-only in the Flatpak, to enable the JVM to properly go into THP mode. We can also expose the manually configured hugepages, for whoever is still using this. On a typical system, the contents of the files exposed might be:
Doing this allows the usage of
-XX:+UseTransparentHugePages
in Minecraft and makes the warning go away. I have verified that this makes the Java process showAnonHugePages
in/proc/$pid/smaps
, indicating that THP is now working properly through the sandboxing.