Question: 8324776: How to safely tell if MADV_POPULATE_WRITE is supported
Thomas Stüfe
thomas.stuefe at gmail.com
Wed Feb 21 16:56:28 UTC 2024
Hi,
I am trying to understand this better.
MADV_POPULATE_READ and MADV_POPULATE_WRITE were added to mainline with
```
commit 4ca9b3859dac14bbef0c27d00667bb5b10917adb
Author: David Hildenbrand <david at redhat.com>
Date: Wed Jun 30 18:52:28 2021 -0700
mm/madvise: introduce MADV_POPULATE_(READ|WRITE) to prefault page
tables
```
and they used 22/23 as numerical identifier:
```
+#define MADV_POPULATE_READ 22 /* populate (prefault) page tables
readable */
+#define MADV_POPULATE_WRITE 23 /* populate (prefault) page tables
writable */
```
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 (?):
https://lore.kernel.org/all/1595869887-23307-1-git-send-email-anthony.yznaga@oracle.com/T/#u
Is this a downstream-only patch specific to the Oracle Linux kernel?
Cheers, Thomas
On Wed, Feb 21, 2024 at 4:25 PM Patrick Zhang OS <
patrick at os.amperecomputing.com> wrote:
> Hi,
>
>
>
> I have a question regarding the regression reported by [1] which was
> caused by the commit [2].
>
>
>
> 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].
>
>
>
> It is a dilemma that how to fix so inside JVM. Thanks for any advice.
>
>
>
> [1] https://bugs.openjdk.org/browse/JDK-8324776
> runtime/os/TestTransparentHugePageUsage.java fails with The usage of THP is
> not enough
>
> [2] https://bugs.openjdk.org/browse/JDK-8315923 pretouch_memory by
> atomic-add-0 fragments huge pages unexpectedly
>
> [3] https://www.man7.org/linux/man-pages/man2/madvise.2.html
>
> [4]
> https://yum.oracle.com/repo/OracleLinux/OL8/developer/UEKR6/aarch64/getPackageSource/kernel-uek-5.4.17-2136.327.2.el8uek.src.rpm,
> linux-5.4.17/include/uapi/asm-generic/mman-common.h#L75
>
> [5]
> https://bugs.openjdk.org/browse/JDK-8324776?focusedId=14651275&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14651275
> .
>
>
>
> Regards
>
> Patrick
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20240221/1ef5b4ea/attachment.htm>
More information about the hotspot-gc-dev
mailing list