RFR: 8312180: (bf) MappedMemoryUtils passes incorrect arguments to msync (aix)

Thomas Stuefe stuefe at openjdk.org
Tue Jul 18 16:37:14 UTC 2023


On Tue, 18 Jul 2023 16:15:30 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> > A bit of background: At the start of the JVM port to AIX (before OpenJDK) we wanted to use 64 KB pages, but the "LargePage" semantics used by the JVM were too rigid and too badly abstracted to be usable.
> > So we instead "fake" a system page size of 64 KB instead of 4 KB by, basically, letting `os::vm_page_size()` return 64 KB. This works surprisingly well in most cases due to some peculiarities of AIX memory management. The real 4 KB system page size is only observable in a select few corner cases, one of which is this msync coding.
> 
> Does this mean that the injected value for Unsafe.PAGE_SIZE is 64k on AIX?

Yes :-(

@backwaterred Try changing UnsafeConstant injection such that we inject the real system page size of 4K instead of using os::vm_page_size() here: https://github.com/openjdk/jdk/blob/b4dce0d62479c2494c02570a60319cb1a5932940/src/hotspot/share/classfile/javaClasses.cpp#L4710. Then, the JDK would see the real 4 KB whereas hotspot would continue to use 64 KB internally. Not sure how well that separation would work, but it may be worth a try.

Mid- to long-term, we could think about reverting that decision and going back to real 4 KB. Essentially, rip out all coding in hotspot guarded by `-XX:+Use64KPages`. We would then see a performance drop because of the increased TLB usage. But maybe today's AIX machines are faster and can compensate for that. A future improvement could be adding real "hotspot-style" large page support using real 1 GB huge pages (which are supported on AIX but we never bothered). 

@AlanBateman As a defense of our old coding: We did this long before OpenJDK existed, and at that time, there was no way to contribute code back to Sun. Today I may do things differently. But back then, we had to aim for a minimally invasive patch, and this lying-about-pagesize worked well. There may be hidden issues like this we have not discovered yet.

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

PR Comment: https://git.openjdk.org/jdk/pull/14904#issuecomment-1640558149


More information about the nio-dev mailing list