RFR: 8276129: PretouchTask should page-align the chunk size

Stefan Karlsson stefank at openjdk.java.net
Tue Nov 2 07:42:13 UTC 2021

On Tue, 2 Nov 2021 01:28:38 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this change to PretouchTask to page-align the chunk size.
> Aligning down is used because it's easy; aligning up would require dealing
> with possible overflow or verifying that overflow isn't possible.
> Testing:
> mach5 tier1
> Locally (linux-x64) java -version with pretouch task logging and various
> chunk sizes, manually verifying the number of workers was as expected.

Marked as reviewed by stefank (Reviewer).

src/hotspot/share/gc/shared/pretouchTask.cpp line 73:

> 71:   // Page-align the chunk size, so if start_address is also page-aligned (as
> 72:   // is common) then there won't be any pages shared by multiple chunks.
> 73:   chunk_size = align_down(chunk_size, page_size);

This looks like a place where align_down_bounded could be used. Something like this:

size_t chunk_size = align_down_bounded(PretouchTask::chunk_size(), page_size);


PR: https://git.openjdk.java.net/jdk/pull/6204

More information about the hotspot-gc-dev mailing list