Skip to content

Commit

Permalink
Fix lower limit and change PreTouchParallelChunkSize default value fr…
Browse files Browse the repository at this point in the history
…om 1g to 4m.
  • Loading branch information
amitdpawar committed Nov 29, 2020
1 parent b1d1499 commit 8ef5ed7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shared/gc_globals.hpp
Expand Up @@ -200,9 +200,9 @@
product(bool, AlwaysPreTouch, false, \
"Force all freshly committed pages to be pre-touched") \
\
product(size_t, PreTouchParallelChunkSize, 1 * G, \
product(size_t, PreTouchParallelChunkSize, 4 * M, \
"Per-thread chunk size for parallel memory pre-touch.") \
range(1, SIZE_MAX / 2) \
range(4*K, SIZE_MAX / 2) \
\
/* where does the range max value of (max_jint - 1) come from? */ \
product(size_t, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \
Expand Down
17 changes: 13 additions & 4 deletions src/hotspot/share/gc/shared/pretouchTask.cpp
Expand Up @@ -27,6 +27,7 @@
#include "runtime/atomic.hpp"
#include "runtime/globals.hpp"
#include "runtime/os.hpp"
#include "utilities/ticks.hpp"

PretouchTask::PretouchTask(const char* task_name,
char* start_address,
Expand Down Expand Up @@ -62,6 +63,8 @@ void PretouchTask::work(uint worker_id) {
}
}

#define TIME_FORMAT "%.3lfms"

void PretouchTask::pretouch(const char* task_name, char* start_address, char* end_address,
size_t page_size, WorkGang* pretouch_gang) {

Expand All @@ -83,14 +86,20 @@ void PretouchTask::pretouch(const char* task_name, char* start_address, char* en
size_t num_chunks = (total_bytes + chunk_size - 1) / chunk_size;

uint num_workers = (uint)MIN2(num_chunks, (size_t)pretouch_gang->total_workers());
log_debug(gc, heap)("Running %s with %u workers for " SIZE_FORMAT " work units pre-touching " SIZE_FORMAT "B.",
task.name(), num_workers, num_chunks, total_bytes);

Ticks start = Ticks::now();
pretouch_gang->run_task(&task, num_workers);
Ticks end = Ticks::now();

log_debug(gc, heap)("%s with %u workers for " SIZE_FORMAT " work units pre-touching " SIZE_FORMAT "B " TIME_FORMAT,
task.name(), num_workers, num_chunks, total_bytes, (end-start).seconds());

} else {
log_debug(gc, heap)("Running %s pre-touching " SIZE_FORMAT "B.",
task.name(), total_bytes);
Ticks start = Ticks::now();
task.work(0);
Ticks end = Ticks::now();
log_debug(gc, heap)("%s pre-touching " SIZE_FORMAT "B " TIME_FORMAT ,
task.name(), total_bytes, (end-start).seconds());
}
}

0 comments on commit 8ef5ed7

Please sign in to comment.