Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
/ jdk16 Public archive

Commit

Permalink
8259380: Correct pretouch chunk size to cap with actual page size
Browse files Browse the repository at this point in the history
Reviewed-by: tschatzl, sjohanss
  • Loading branch information
Patrick Zhang authored and Thomas Schatzl committed Jan 12, 2021
1 parent 28ff2de commit 67e1b63
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hotspot/share/gc/shared/pretouchTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ void PretouchTask::work(uint worker_id) {

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

// Chunk size should be at least (unmodified) page size as using multiple threads
// pretouch on a single page can decrease performance.
size_t chunk_size = MAX2(PretouchTask::chunk_size(), page_size);
#ifdef LINUX
// When using THP we need to always pre-touch using small pages as the OS will
// initially always use small pages.
page_size = UseTransparentHugePages ? (size_t)os::vm_page_size() : page_size;
#endif
size_t chunk_size = MAX2(PretouchTask::chunk_size(), page_size);

PretouchTask task(task_name, start_address, end_address, page_size, chunk_size);
size_t total_bytes = pointer_delta(end_address, start_address, sizeof(char));
Expand Down

1 comment on commit 67e1b63

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.