RFR: JDK-8310107: os::trace_page_sizes_for_requested_size should name alignment as requested page size
Stefan Karlsson
stefank at openjdk.org
Fri Jun 16 07:25:59 UTC 2023
On Thu, 15 Jun 2023 07:02:02 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> Somewhat trivial renaming patch.
>
> `os::trace_page_sizes_for_requested_size()` names "alignment" what is actually the requested page size. Historically, the distinction between "alignment" and "page size" in memory reservation code has not been clear. We often use "alignment" where we mean "page size". OTOH, ReservedSpace constructor takes a "preferred page size" argument, which it then uses as both alignment request and pagesize request, meaning that even if it fails to get the desired page size it attempts to satisfy the alignment.
>
> Clearing this up would be a larger effort. Here, I propose to rename "alignment" to "requested page size" in `os::trace_page_sizes_for_requested_size()` since it clearer conveys the difference between requested and actual page size, which is the important bit for pagesize logging.
>
> ---
>
> Patch renames "alignment" to "requested pagesize" in printout and code.
>
> It also reshuffles the parameters somewhat to have requested properties at the beginning, followed by the actual properties of the region.
>
> Printout before, for a failed 2M paged allocation. Notice the difference between requested and actual page size, the latter being labeled as "alignment"):
>
>
> OpenJDK 64-Bit Server VM warning: Failed to reserve and commit memory using large pages. req_addr: 0x0000000000000000 bytes: 2097152
> [0.012s][info][pagesize] Block Offset Table: req_size=2M base=0x00007f3518200000 page_size=4K alignment=2M size=2M
>
>
> Printout now:
>
>
> OpenJDK 64-Bit Server VM warning: Failed to reserve and commit memory using large pages. req_addr: 0x0000000000000000 bytes: 2097152
> [0.011s][info][pagesize] Block Offset Table: req_size=2M req_page_size=2M base=0x00007fda0e400000 size=2M page_size=4K
I think this looks reasonable and we should also change `os::trace_page_sizes` to have the same order when printing `base`, `size`, and `page_size`.
-------------
PR Review: https://git.openjdk.org/jdk/pull/14484#pullrequestreview-1482884020
More information about the hotspot-dev
mailing list