RFR: 8315923: pretouch_memory by atomic-add-0 fragments huge pages unexpectedly [v27]

Liming Liu duke at openjdk.org
Mon Jan 15 06:45:54 UTC 2024


> As described at [JDK-8315923](https://bugs.openjdk.org/browse/JDK-8315923), this patch uses madvise with MADV_POPULATE_WRITE to pretouch memory when supported (since kernel 5.14).
> 
> Ran the newly added jtreg test on 64c Neoverse-N1 machines with kernel 4.18, 5.13 and 6.1, and observed that transparent huge pages formed right after pretouch on kernel 6.1. Recorded the time spent on the test in *seconds* with `VERBOSE=time` as the table below, and got that the patch takes improvements when the system call is supported, while does not hurt if not supported:
> 
> <table>
>   <tr>
>     <th>Kernel</th>
>     <th colspan="2"><tt>-XX:-TransparentHugePages</tt></th>
>     <th colspan="2"><tt>-XX:+TransparentHugePages</tt></th>
>   </tr>
>   <tr><td></td><td>Unpatched</td><td>Patched</td><td>Unpatched</td><td>Patched</td></tr>
>   <tr><td>4.18</td><td>11.30</td><td>11.30</td><td>0.25</td><td>0.25</td></tr>
>   <tr><td>5.13</td><td>0.22</td><td>0.22</td><td>3.42</td><td>3.42</td></tr>
>   <tr><td>6.1</td><td>0.27</td><td>0.33</td><td>3.54</td><td>0.33</td></tr>
> </table>

Liming Liu has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 35 commits:

 - Use the suggested structure and delect MADV_POPULATE_WRITE during initialization
 - Make it fail with 2MB huge pages
   
   2MB huge pages are easier to form. After becoming shredded, there would
   still be a small number of 2MB huge pages. Thus this commit enlarges
   the boundary of usage from 0 to the half of the heap.
 - Reduce a return
 - untabify
 - Correct the fallback case
 - Add an option to be able not to use MADV_POPULATE_WRITE
 - Use serial GC for the test
 - Use pthread instead
 - Remove the deletion
 - Fix type errors
 - ... and 25 more: https://git.openjdk.org/jdk/compare/bdee968e...cf617f21

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

Changes: https://git.openjdk.org/jdk/pull/15781/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15781&range=26
  Stats: 245 lines in 10 files changed: 230 ins; 7 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/15781.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15781/head:pull/15781

PR: https://git.openjdk.org/jdk/pull/15781


More information about the hotspot-runtime-dev mailing list