RFR: JDK-8310388: Shenandoah: Auxiliary bitmap is not madvised for THP
Aleksey Shipilev
shade at openjdk.org
Thu Jul 20 15:43:42 UTC 2023
On Thu, 20 Jul 2023 11:19:53 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> See details in JBS isse.
>
> Note that there is no actual functional difference. AUX bitmap did not use THPs before this patch and does not now either. The only difference is that before, the JVM *thought* the AUX bitmap uses THPs when in fact it did not. That caused confusion.
>
> (All this illuminates how badly thought out the ReservedSpace API really is. We pass in page size to the constructor, but then need to commit manually; THPs actually use madvise on commit, not on reservation, so we need to pass page size in *again* to commit. Ideally, ReservedSpace should handle committing for us with the page size it saved from reservation.)
>
> Note that this only takes care of preventing THP formation in "madvise" mode. In "always" mode, the kernel will do THP coalescation always. We could prevent it from doing so by advising against it via madvise, but that would require extension of the platform generic reservation APIs and is left for a different RFE. Ideally, nobody should use THP "always" mode.
Looks fine.
Does it make sense to enable `runtime/os/TestTracePageSizes.java` now?
src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 287:
> 285: // since we know these commits will be short lived.
> 286: const size_t aux_bitmap_page_size =
> 287: LINUX_ONLY(UseTransparentHugePages ? os::vm_page_size() :) bitmap_page_size;
There is a `ifdef LINUX` THP-related block in the same file, so better to match its style:
size_t aux_bitmap_page_size = bitmap_page_size;
#ifdef LINUX
// In THP "advise" mode, we refrain from advising the system to use large pages
// since we know these commits will be short lived, and there is no reason to trash
// the THP area with this bitmap.
if (UseTransparentHugePages) {
aux_bitmap_page_size = os::vm_page_size();
}
#endif
-------------
Marked as reviewed by shade (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14953#pullrequestreview-1539574286
PR Review Comment: https://git.openjdk.org/jdk/pull/14953#discussion_r1269649730
More information about the shenandoah-dev
mailing list