RFR: 8321529: log_on_large_pages_failure reports log_debug(gc, heap, coops) for ReservedCodeSpace failures [v2]
Evgeny Astigeevich
eastigeevich at openjdk.org
Thu Jan 30 13:41:48 UTC 2025
On Thu, 30 Jan 2025 02:47:52 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Stefan Karlsson has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update memoryReserver.cpp
>
> In the context of where this code was originally added ([JDK-8265268](https://bugs.openjdk.org/browse/JDK-8265268)), in `virtualSpace.cpp` the use of `log_debug(gc, heap, coops)` was consistent with, and formed part of the tracing for, all the memory logging in that code. I don't disagree that you might want to more generically enable this logging, but it will now be missing from that established logging path. It doesn't affect me either way, but people who use that logging may have a stronger opinion.
Hi @dholmes-ora,
Looking into the history, I found the code was added in the context of [JDK-8152896](https://bugs.openjdk.org/browse/JDK-8152896).
The original logging was:
```c++
void ReservedSpace::initialize(size_t size, size_t alignment, bool large,
char* requested_address,
bool executable) {
...
// failed; try to reserve regular memory below
if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
!FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
if (PrintCompressedOopsMode) {
tty->cr();
tty->print_cr("Reserve regular memory without large pages.");
}
}
It was added by the fix of [JDK-6947341](https://bugs.openjdk.org/browse/JDK-6947341).
The logging was intended for the Java heap.
IMO, the code is missing a check of `executable` not to print the message for CodeCache.
To get functionality close to the original and not to print the message for CodeCache we can do:
```c++
63: static void log_on_large_pages_failure(char* req_addr, size_t bytes, bool executable) {
if (large_pages_requested()) {
if (executable) {
log_debug(codecache)("Reserve regular memory without large pages "
RANGEFMT, RANGEFMTARGS(req_addr, bytes));
} else {
log_debug(gc, heap, coops)("Reserve regular memory without large pages "
RANGEFMT, RANGEFMTARGS(req_addr, bytes));
}
// JVM style warning that we did not succeed in using large pages.
char msg[128];
jio_snprintf(msg, sizeof(msg), "Failed to reserve and commit memory using large pages. "
"req_addr: " PTR_FORMAT " bytes: %zu",
req_addr, bytes);
warning("%s", msg);
}
188: log_on_large_pages_failure(requested_address, size, executable);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23297#issuecomment-2624545576
More information about the hotspot-dev
mailing list