<div dir="ltr"><div>Hi,</div><div><br></div><div>I am trying to understand this better.</div><div><br></div><div>MADV_POPULATE_READ and MADV_POPULATE_WRITE were added to mainline with</div><div></div><br><div>```</div><div> commit 4ca9b3859dac14bbef0c27d00667bb5b10917adb<br> Author: David Hildenbrand <<a href="mailto:david@redhat.com">david@redhat.com</a>><br> Date:   Wed Jun 30 18:52:28 2021 -0700<br>     mm/madvise: introduce MADV_POPULATE_(READ|WRITE) to prefault page tables  <br></div><div>```</div><div><br></div><div>and they used 22/23 as numerical identifier:</div><div><br></div><div>```</div><div>+#define MADV_POPULATE_READ     22      /* populate (prefault) page tables readable */<br>+#define MADV_POPULATE_WRITE    23      /* populate (prefault) page tables writable */</div><div>```<br></div><div><br></div><div>But I don't see a patch in mainline for MADV_DOEXEC. I do see a very lengthy RFR thread that seemed to end in patent disputes (?):<br></div><div></div><div></div><div><a href="https://lore.kernel.org/all/1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com/T/#u">https://lore.kernel.org/all/1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com/T/#u</a></div><div></div><div><br></div><div>Is this a downstream-only patch specific to the Oracle Linux kernel?</div><div><br></div><div>Cheers, Thomas<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 21, 2024 at 4:25 PM Patrick Zhang OS <<a href="mailto:patrick@os.amperecomputing.com">patrick@os.amperecomputing.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-616747155859097897">





<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_-616747155859097897WordSection1">
<p class="MsoNormal">Hi, <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have a question regarding the regression reported by [1] which was caused by the commit [2].<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The root cause can be briefly described as: MADV_POPULATE_WRITE has been supported since Linux 5.14. It is suggested to call madvise(0, 0, advice) to tell if this madvise mode is valid, which “will return zero iff advice is supported by
 the kernel and can be relied on to probe for support” [3]. However Oracle UEKR6 5.4.17 has a duplicate definition of the number 23: MADV_DONTEXEC [4]. As a result, the test passes on Linux 5.4 mainline, while fails on UEK 5.4.17, because madvise(0, 0, 23)
 gives different return values. See details at [5].<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">It is a dilemma that how to fix so inside JVM. Thanks for any advice.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">[1] <a href="https://bugs.openjdk.org/browse/JDK-8324776" target="_blank">https://bugs.openjdk.org/browse/JDK-8324776</a> runtime/os/TestTransparentHugePageUsage.java fails with The usage of THP is not enough<u></u><u></u></p>
<p class="MsoNormal">[2] <a href="https://bugs.openjdk.org/browse/JDK-8315923" target="_blank">https://bugs.openjdk.org/browse/JDK-8315923</a> pretouch_memory by atomic-add-0 fragments huge pages unexpectedly<u></u><u></u></p>
<p class="MsoNormal">[3] <a href="https://www.man7.org/linux/man-pages/man2/madvise.2.html" target="_blank">
https://www.man7.org/linux/man-pages/man2/madvise.2.html</a><u></u><u></u></p>
<p class="MsoNormal">[4] <a href="https://yum.oracle.com/repo/OracleLinux/OL8/developer/UEKR6/aarch64/getPackageSource/kernel-uek-5.4.17-2136.327.2.el8uek.src.rpm" target="_blank">
https://yum.oracle.com/repo/OracleLinux/OL8/developer/UEKR6/aarch64/getPackageSource/kernel-uek-5.4.17-2136.327.2.el8uek.src.rpm</a>, linux-5.4.17/include/uapi/asm-generic/mman-common.h#L75<u></u><u></u></p>
<p class="MsoNormal">[5] <a href="https://bugs.openjdk.org/browse/JDK-8324776?focusedId=14651275&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14651275" target="_blank">
https://bugs.openjdk.org/browse/JDK-8324776?focusedId=14651275&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14651275</a>.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Regards<u></u><u></u></p>
<p class="MsoNormal">Patrick<u></u><u></u></p>
</div>
</div>

</div></blockquote></div>