<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.im
        {mso-style-name:im;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hello all,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I have uploaded a revised patch for supporting allocation of Java Heap on NV-DIMMs. Support is added on Windows and Linux.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">The patch has been tested on all the allocation paths –fixed address (for compressed oops), unfixed address (for uncompressed oops), allocation with failures
 and consequent retries, alignment failures.. etc.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I would appreciate if someone could review it and provide feedback.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal">Webrev : http://cr.openjdk.java.net/~vdeshpande/8153327/webrev.03/<br>
Bug : <a href="https://bugs.openjdk.java.net/browse/JDK-8153327" target="_blank">
https://bugs.openjdk.java.net/browse/JDK-8153327</a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Kishor<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Kharbas, Kishor
<br>
<b>Sent:</b> Monday, July 18, 2016 4:13 PM<br>
<b>To:</b> Thomas Stüfe <thomas.stuefe@gmail.com><br>
<b>Cc:</b> Per Liden <per.liden@oracle.com>; hotspot-gc-dev@openjdk.java.net; Kharbas, Kishor <kishor.kharbas@intel.com><br>
<b>Subject:</b> RE: Supporting allocation of Java object heap on NV-DIMMS<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hi Thomas,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks for raising this question.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">This memory will support mprotect(). AFAIK, mprotect() is implemented by OS memory management and is independent of the DIMM technology used.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">So we won’t run into problems like you mentioned.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Kishor<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Thomas Stüfe [</span><a href="mailto:thomas.stuefe@gmail.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">mailto:thomas.stuefe@gmail.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">]
<br>
<b>Sent:</b> Monday, June 6, 2016 3:22 AM<br>
<b>To:</b> Kharbas, Kishor <</span><a href="mailto:kishor.kharbas@intel.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">kishor.kharbas@intel.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">><br>
<b>Cc:</b> Per Liden <</span><a href="mailto:per.liden@oracle.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">per.liden@oracle.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">>;
</span><a href="mailto:hotspot-gc-dev@openjdk.java.net"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">hotspot-gc-dev@openjdk.java.net</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
<b>Subject:</b> Re: Supporting allocation of Java object heap on NV-DIMMS<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Kishor,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">short question, would this new memory support mprotect() ?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If no, we may run into problems when using compressed oops with implicit null checks, because the base zone of the heap needs to be protected. (I do not know if there would be any other uses of mprotect on the heap memory).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Kind Regards, Thomas<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Sat, Jun 4, 2016 at 3:45 AM, Kharbas, Kishor <<a href="mailto:kishor.kharbas@intel.com" target="_blank">kishor.kharbas@intel.com</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">Hello all,<br>
<br>
I have an update to the patch,  adding support for Windows.<br>
It uses the Windows APIs described in <a href="https://channel9.msdn.com/Events/Build/2016/P470" target="_blank">
https://channel9.msdn.com/Events/Build/2016/P470</a> to map Java heap to NV-DIMM memory.<br>
<br>
Link to webrev: <a href="http://cr.openjdk.java.net/~vdeshpande/8153327/webrev.02/" target="_blank">
http://cr.openjdk.java.net/~vdeshpande/8153327/webrev.02/</a><br>
JBS entry : <a href="https://bugs.openjdk.java.net/browse/JDK-8153327" target="_blank">
https://bugs.openjdk.java.net/browse/JDK-8153327</a><br>
<br>
Will like to hear your feedback!!<br>
<br>
Thanks<br>
<span class="hoenzb"><span style="color:#888888">Kishor</span></span><span style="color:#888888"><br>
</span><br>
<span class="im">> -----Original Message-----</span><br>
<span class="im">> From: Kharbas, Kishor</span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">> Sent: Tuesday, May 24, 2016 3:03 PM<br>
> To: Per Liden; <a href="mailto:hotspot-gc-dev@openjdk.java.net">hotspot-gc-dev@openjdk.java.net</a><br>
> Cc: Kharbas, Kishor<br>
> Subject: RE: Supporting allocation of Java object heap on NV-DIMMS<br>
><br>
> Oops.. forgot to insert the link to the new webrev.<br>
><br>
> <a href="http://cr.openjdk.java.net/~vdeshpande/8153327/webrev.01/" target="_blank">
http://cr.openjdk.java.net/~vdeshpande/8153327/webrev.01/</a><br>
> <a href="https://bugs.openjdk.java.net/browse/JDK-8153327" target="_blank">https://bugs.openjdk.java.net/browse/JDK-8153327</a><br>
><br>
> - Kishor<br>
><br>
> > -----Original Message-----<br>
> > From: Kharbas, Kishor<br>
> > Sent: Tuesday, May 24, 2016 2:39 PM<br>
> > To: Per Liden; <a href="mailto:hotspot-gc-dev@openjdk.java.net">hotspot-gc-dev@openjdk.java.net</a><br>
> > Cc: Kharbas, Kishor<br>
> > Subject: RE: Supporting allocation of Java object heap on NV-DIMMS<br>
> ><br>
> > Sorry for the long hiatus on this thread.<br>
> > As it was apparent that it would have been difficult to integrate the<br>
> > patch  in JDK9, I took some time to re-implement the feature.<br>
> ><br>
> > In the new patch, I do not change the existing functions in 'os' class<br>
> > which reserve memory for the heap.<br>
> > The existing logic in ReservedSpace::initialize() and<br>
> > ReservedHeapSpace::try_reserve_heap() to reserve a virtual address is<br>
> > untouched. Only after a virtual address range is successfully<br>
> > allocated, I call a newly added function which maps this address range<br>
> > to physical memory on the NV-DIMM<br>
> ><br>
> > The new call is os::map_memory_to_file() and its implemented for Linux<br>
> > at this point.<br>
> > I wanted to know your thoughts before I implement the function for<br>
> > windows and other OS'es.<br>
> ><br>
> > Thank you<br>
> > Kishor<br>
> ><br>
> > > -----Original Message-----<br>
> > > From: Kharbas, Kishor<br>
> > > Sent: Wednesday, April 13, 2016 4:43 PM<br>
> > > To: Per Liden; <a href="mailto:hotspot-gc-dev@openjdk.java.net">hotspot-gc-dev@openjdk.java.net</a><br>
> > > Cc: Kharbas, Kishor<br>
> > > Subject: RE: Supporting allocation of Java object heap on NV-DIMMS<br>
> > ><br>
> > > Hi Per,<br>
> > ><br>
> > > Here are the answers to your questions - 1. You have an interesting<br>
> > > point about non-heap memory. The current prototype only allocates<br>
> > > object heap on the new memory. We do not have plans to allocate<br>
> > > other JVM structures like cardtables, bitmaps on the new memory<br>
> > > device. In the future we will look into it.<br>
> > >      For now we are very interested in getting this patch in JDK9<br>
> > > atleast as an experimental feature.<br>
> > ><br>
> > > 2.  The 3D XPoint memory has the same semantics as DRAM, and no<br>
> > > special handling is required from the user/JVM perspective.<br>
> > > With regards to  pages sizes, ext4-DAX implicitly tries to allocate<br>
> > > largest granularity pages as possible.<br>
> > > The mmap() system call I use in the patch passes a 'fd' in the<br>
> > > directory provided by the new cmd line option "FSDirForHeap". In<br>
> > > this case, UseLargePages flag is ignored and the size of pages<br>
> > > allocated is upto to the filesystem.<br>
> > ><br>
> > > Regards<br>
> > > Kishor<br>
> > ><br>
> > ><br>
> > ><br>
> > > > -----Original Message-----<br>
> > > > From: Per Liden [mailto:<a href="mailto:per.liden@oracle.com">per.liden@oracle.com</a>]<br>
> > > > Sent: Wednesday, April 13, 2016 4:48 AM<br>
> > > > To: Kharbas, Kishor; <a href="mailto:hotspot-gc-dev@openjdk.java.net">hotspot-gc-dev@openjdk.java.net</a><br>
> > > > Subject: Re: Supporting allocation of Java object heap on NV-DIMMS<br>
> > > ><br>
> > > > Hi,<br>
> > > ><br>
> > > > On 2016-04-12 19:32, Kharbas, Kishor wrote:<br>
> > > > > Hi!<br>
> > > > ><br>
> > > > > In addition to points made in previous email, we have seen<br>
> > > > > performance in<br>
> > > > application performance by having larger heaps on 3D XPoint. With<br>
> > > > proper tuning, the upside of having less GCs outweighs the<br>
> > > > negative impact of slower latency.<br>
> > > > > Besides that, the patch is implemented so that it has least<br>
> > > > > impact on<br>
> > > > existing code path, to make sure there is no regression.<br>
> > > > ><br>
> > > > > Would like to hear your thoughts and also the possibility of<br>
> > > > > getting it in JDK<br>
> > > > 9.<br>
> > > ><br>
> > > > First of all, I can just note that JDK 9 Feature Complete date is<br>
> > > > getting very close.<br>
> > > ><br>
> > > > There seems to be at least two layers here:<br>
> > > ><br>
> > > > 1) The command line flag to direct heap mappings to be backed by a<br>
> file.<br>
> > > ><br>
> > > > Having a flag like this sounds overall reasonable and useful.<br>
> > > ><br>
> > > > What's your vision going forward here? Is there a reason to<br>
> > > > believe we might want to use this of non-Java heap memory in some<br>
> future?<br>
> > > > Marking bitmaps, malloc(), etc? How this is implemented,<br>
> > > > configured, options names, etc might be influenced if we foresee such<br>
> a future.<br>
> > > ><br>
> > > > General testing of these code paths could be done by mapping a<br>
> > > > file on tmpfs, or something similar.<br>
> > > ><br>
> > > ><br>
> > > > 2) The specific use case where this flag is used to a map 3D<br>
> > > > XPoint backed file.<br>
> > > ><br>
> > > > Will this memory have the same semantics as RAM, with regards to<br>
> > > > ordering, atomics, etc? Will there be a need for white listing<br>
> > > > known good types of memory/devices/filesystems which we can safely<br>
> > > > use for backing the heap?<br>
> > > ><br>
> > > > How does this interact with various pages sizes? E.g. mapping 3D<br>
> > > > XPoint memory with MAP_HUGETLB works?<br>
> > > ><br>
> > > > Testing of this obviously requires special hardware.<br>
> > > ><br>
> > > ><br>
> > > > cheers,<br>
> > > > Per<br>
> > > ><br>
> > > > ><br>
> > > > > Please do let me know if I need to make any changes and improve<br>
> > > > > the<br>
> > > > patch in any way.<br>
> > > > ><br>
> > > > > Regards<br>
> > > > > Kishor<br>
> > > > ><br>
> > > > > -----Original Message-----<br>
> > > > > From: Kharbas, Kishor<br>
> > > > > Sent: Tuesday, April 5, 2016 10:00 AM<br>
> > > > > To: 'Per Liden'; <a href="mailto:hotspot-gc-dev@openjdk.java.net">hotspot-gc-dev@openjdk.java.net</a><br>
> > > > > Cc: Kharbas, Kishor<br>
> > > > > Subject: RE: Supporting allocation of Java object heap on<br>
> > > > > NV-DIMMS<br>
> > > > ><br>
> > > > > Hi Per,<br>
> > > > ><br>
> > > > > We see application of this feature in large scale multi-JVM<br>
> > > > > deployments to<br>
> > > > increase resource utilization. We could run daemon/service JVMs<br>
> > > > with heap on slower memory and thus free up DRAM for critical<br>
> processes.<br>
> > > > > At Intel we have done internal experiments on large middleware<br>
> > > > applications and have seen benefit of this feature.<br>
> > > > ><br>
> > > > > Thanks<br>
> > > > > Kishor<br>
> > > > ><br>
> > > > > -----Original Message-----<br>
> > > > > From: Per Liden [mailto:<a href="mailto:per.liden@oracle.com">per.liden@oracle.com</a>]<br>
> > > > > Sent: Monday, April 4, 2016 4:37 AM<br>
> > > > > To: Kharbas, Kishor; <a href="mailto:hotspot-gc-dev@openjdk.java.net">hotspot-gc-dev@openjdk.java.net</a><br>
> > > > > Subject: Re: Supporting allocation of Java object heap on<br>
> > > > > NV-DIMMS<br>
> > > > ><br>
> > > > > Hi,<br>
> > > > ><br>
> > > > > On 2016-04-02 03:13, Kharbas, Kishor wrote:<br>
> > > > >> Hello all,<br>
> > > > >><br>
> > > > >> I would like to propose adding a capability in the JVM to<br>
> > > > >> allocate object heap on new kinds of heterogeneous memories<br>
> > > > >> which are<br>
> > > > exposed<br>
> > > > >> through a file system. This could be achieved by adding a<br>
> > > > >> command line option to specify a path in the filesystem which<br>
> > > > >> would be used for<br>
> > > > >> mmap() system call.<br>
> > > > >><br>
> > > > >> Details:<br>
> > > > >><br>
> > > > >> Linux kernel 4.0 onwards supports DAX mode[1] in Ext4 file<br>
> > > > >> system [2] which is designed to support new heterogeneous<br>
> > > > >> memory devices such<br>
> > > > as<br>
> > > > >> Intel's 3D XPoint memory [3]. DAX mode removes the need for<br>
> > > > >> page<br>
> > > > cache<br>
> > > > >> and provides a direct mapping of process virtual space to<br>
> > > > >> storage<br>
> > space.<br>
> > > > >><br>
> > > > >> We would like to add a command line option called "FSDirForHeap"<br>
> > > > >> which will - 1) Enable using a file system as backing store for<br>
> > > > >> Java object heap 2) Use the provided path to create a temporary<br>
> > > > >> file for mmap() system call.<br>
> > > > ><br>
> > > > > The new kinds of memories opens up for some new and interesting<br>
> > > > possibilities. However, as long as DRAM is faster (which I assume<br>
> > > > they will continue be for at least some time), I have a hard time<br>
> > > > seeing that you want to place your whole heap onto the NV-DIMMs. I<br>
> > > > can see that some applications might want to place some large<br>
> > > > subset of their data<br>
> > > there (e.g.<br>
> > > > an in memory-database), but I'm also guessing that placing the<br>
> > > > whole heap there would come with a noticeable impact on<br>
> > > > performance? Any thoughts on that?<br>
> > > > ><br>
> > > > > Do you have any data to share with regards to performance<br>
> > > > > difference on<br>
> > > > some relevant workloads? That would help in getting a better<br>
> > > > understanding of the feasibility of this mode of operation.<br>
> > > > ><br>
> > > > > cheers,<br>
> > > > > Per<br>
> > > > ><br>
> > > > >><br>
> > > > >> The description of the feature can be found at<br>
> > > > >> <a href="https://bugs.openjdk.java.net/browse/JDK-8153327" target="_blank">
https://bugs.openjdk.java.net/browse/JDK-8153327</a><br>
> > > > >><br>
> > > > >> and the webrev is uploaded at<br>
> > > > >> <a href="http://cr.openjdk.java.net/~vdeshpande/8153327/webrev.00/" target="_blank">
http://cr.openjdk.java.net/~vdeshpande/8153327/webrev.00/</a><br>
> > > > >><br>
> > > > >> References:<br>
> > > > >><br>
> > > > >> [1]<br>
> > > > >> <a href="https://www.kernel.org/doc/Documentation/filesystems/dax.txt" target="_blank">
https://www.kernel.org/doc/Documentation/filesystems/dax.txt</a><br>
> > > > >><br>
> > > > >> [2]<br>
> > > > >> <a href="https://www.kernel.org/doc/Documentation/filesystems/ext4.txt" target="_blank">
https://www.kernel.org/doc/Documentation/filesystems/ext4.txt</a><br>
> > > > >><br>
> > > > >> [3]<br>
> > > > >> <a href="https://newsroom.intel.com/press-kits/introducing-intel-optane-" target="_blank">
https://newsroom.intel.com/press-kits/introducing-intel-optane-</a><br>
> > > > >> te<br>
> > > > >> ch nol<br>
> > > > >> ogy-bringing-3d-xpoint-memory-to-storage-and-memory-products/<br>
> > > > >><br>
> > > > >> Much appreciated!<br>
> > > > >><br>
> > > > >> Thanks you.<br>
> > > > >><br>
> > > > >> Kishor Kharbas<br>
> > > > >><o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>