RFR: 8027915: TestParallelHeapSizeFlags fails with unexpected heap size on sparcv9

Erik Helin erik.helin at oracle.com
Tue May 6 08:44:06 UTC 2014


Hi all,

this patch changes
os::page_size_for_region(min_size, max_size, min_pages) to always
guarantee that the returned page size <= max_size / min_pages. Prior
to this patch, page_size_for_region could return a page size larger
than max_size / min_pages. This can cause some unexpected behavior
for code using page_size_for_region, such as the following regression tests:

http://cr.openjdk.java.net/~ehelin/8027915/regression-test/

As the test shows, if you have a 2 MB region and you must use at least
2 pages, you would still get back 2 MB as the page size on a Linux
machine that supports 2 MB large pages. The reason for this is
explained in a comment above the function in os.hpp:

// The current implementation ignores min_pages if a larger page
// size is an exact multiple of both region_min_size and
// region_max_size.  This allows larger pages to be used when doing
// so would not cause fragmentation; in particular, a single page can
// be used when region_min_size == region_max_size == a supported page
// size.

Reducing fragmentation of large pages is good but the varying return 
value makes it very hard to depend on os::page_size_for_region in 
calculations (for example when sizing the heap).

This patch removes the fragmentation prevention mechanism, simplifies
the function and adds a regression tests:

http://cr.openjdk.java.net/~ehelin/8027915/webrev.00/

Testing:
- JPRT

Thanks,
Erik


More information about the hotspot-dev mailing list