Support 5 Level Paging and allow mmap to use greater than 128TB of virtual address space on Linux
Joseph Walker
joe at chubbypenguin.net
Sun Jan 26 16:16:23 UTC 2025
Our use case is a dataset exceeding 200TB on a single server with
elasticsearch. Enabling 5 Level Paging support requires passing a
hint address greater than 47-bit to mmap.
[https://docs.kernel.org/arch/x86/x86_64/5level-paging.html]
The patch below works in our environment and is now used in production:
diff --git a/src/java.base/unix/native/libnio/ch/UnixFileDispatcherImpl.c
b/src/java.base/unix/native/libnio/ch/UnixFileDispatcherImpl.c
index a24f0503e55..23b7068ff21 100644
--- a/src/java.base/unix/native/libnio/ch/UnixFileDispatcherImpl.c
+++ b/src/java.base/unix/native/libnio/ch/UnixFileDispatcherImpl.c
@@ -320,7 +320,7 @@ Java_sun_nio_ch_UnixFileDispatcherImpl_map0(JNIEnv
*env, jclass klass, jobject f
}
mapAddress = mmap64(
- 0, /* Let OS decide location */
+ (void*)0xFFFFFFFF00000000LL, /* Let OS
decide location */
len, /* Number of bytes to map */
protections, /* File permissions */
flags, /* Changes are shared */
Thanks,
Joe
More information about the nio-dev
mailing list