I think DirectByteBuffer do not use large page. Please refer to https://bugs.openjdk.java.net/browse/JDK-8021829 for more details.
Our code changes are done for alignment. I think they should not impact the usage of either small pages or large pages. Thanks, Lucy >-----Original Message----- >From: David M. Lloyd [mailto:david.ll...@redhat.com] >Sent: Thursday, November 03, 2016 5:15 AM >To: Lu, Yingqi <yingqi...@intel.com>; Alan Bateman <alan.bate...@oracle.com> >Cc: nio-...@openjdk.java.net; Kharbas, Kishor <kishor.khar...@intel.com>; >core-libs-dev@openjdk.java.net; Kaczmarek, Eric <eric.kaczma...@intel.com> >Subject: Re: Proposal for adding O_DIRECT support into JDK 9 > >What happens if you're using large pages? Are the direct buffers always >allocated off of small pages? > >On 11/02/2016 06:34 PM, Lu, Yingqi wrote: >> Hi All, >> >> Our most recent DirectIO patch is available at >> http://cr.openjdk.java.net/~igraves/8164900-3/ >> >> In this version, we made following changes: >> >> 1. Removed the flag "direct" from FileDescriptor class. Instead, moved it to >> the >FileChannelImpl class. >> >> 2. Provided a way for user to allocate a page aligned direct ByteBuffer. >> 1) Added a constructor DirectByteBuffer(int cap, boolean direct) to >> allocate a >direct ByteBuffer that is aligned to the page size. >> 2) Added Util.getTemporaryAlignedDirectBuffer(int size) >> 3) Added DirectByteBuffer.isAligned(int pos) to check if the buffer is >> aligned >before doing native IO with it. >> >> 3. Moved all the alignment check from C code to Java code (mainly >FileChannelImpl and IOUtil.java). >> >> 4. Made the DirectIO functionality consistent between read and write >operations. With current version of the patch, user would be responsible for >the >alignment with file offset and IO size. >> >> 5. Made the API for DirectIO more extensible to all the supporting platforms. >> 1) Unix OS specific code are done through UnixConstants.java.template and >FileChannelImpl.c. >> 2) Coded and tested for Linux and OS X (OS X testing is done through >VirtualBox with OS X VM on top of Linux OS). >> 3) Coded for Solaris. We do not have environment to test it so that we >commented the changes out. >> >> 6. We added 4 test cases following the existing non-direct IO examples. >> >> 7. We did jtreg test for the entire nio package and no errors were found due >> to >our changes. >> >> Please let us know your feedback and comment. Thank you very much for your >time and consideration! >> >> Thanks, >> Lucy >> >>> -----Original Message----- >>> From: Alan Bateman [mailto:alan.bate...@oracle.com] >>> Sent: Monday, October 17, 2016 7:59 AM >>> To: Lu, Yingqi <yingqi...@intel.com> >>> Cc: nio-...@openjdk.java.net; Kaczmarek, Eric >>> <eric.kaczma...@intel.com>; Kharbas, Kishor >>> <kishor.khar...@intel.com> >>> Subject: Re: Proposal for adding O_DIRECT support into JDK 9 >>> >>> On 12/10/2016 17:41, Lu, Yingqi wrote: >>> >>>> : >>>> >>>> You are correct about the "extra copy" with DirectIO. Will it be >>>> acceptable if we >>> add a function "Util.getAlignedTemporaryDirectBuffer" and use that >>> for the DirectIO operation? In this case, I think we should be able >>> to avoid the additional copy? >>>> >>> Yes, that should work but it still lacks a way for the user to get an >>> aligned buffer and so you will always be copying in and out of an >>> aligned buffer. The other thing is the sizing of the I/O operation >>> where I think you will also need a way to expose the multiple (or block >>> size) to >the user. >>> >>> -Alan. > >-- >- DML