8213927: G1 ignores AlwaysPreTouch when UseTransparentHugePages is enabled
Summary: With UseTransparentHugePages we always need to pretouch on small page size as the underlying memory could currently be allocated as either small or large pages.
Reviewed-by: shade, sjohanss
--- a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp Thu Nov 22 09:25:19 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp Thu Nov 22 09:26:51 2018 +0100
@@ -232,14 +232,19 @@
char* volatile _cur_addr;
char* const _start_addr;
char* const _end_addr;
- size_t const _page_size;
+ size_t _page_size;
public:
G1PretouchTask(char* start_address, char* end_address, size_t page_size) :
AbstractGangTask("G1 PreTouch"),
_cur_addr(start_address),
_start_addr(start_address),
_end_addr(end_address),
- _page_size(page_size) {
+ _page_size(0) {
+#ifdef LINUX
+ _page_size = UseTransparentHugePages ? (size_t)os::vm_page_size(): page_size;
+#else
+ _page_size = page_size;
+#endif
}
virtual void work(uint worker_id) {