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

Thomas Stuefe stuefe at openjdk.org
Tue Jul 18 15:56:03 UTC 2023


On Tue, 18 Jul 2023 15:30:23 GMT, Tyler Steele <tsteele at openjdk.org> wrote:

> > what does Unsafe::pageSize return vs. sysconf(_SC_PAGESIZE)[?]
> 
> It boils down to [Dynamic Variable Page Sizes](https://www.ibm.com/docs/en/aix/7.2?topic=support-dynamic-variable-page-size), which is an AIX feature. The larger page size returned by Unsafe::pageSize is the system page size (by default 64 KiB). The page size required by msync (and returned by sysconf(_SC_PAGESIZE) is the fine-grained page size (by default 4 KiB).

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.

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

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


More information about the nio-dev mailing list