RFR: 8369658: Client emulation mode sets MaxRAM too late [v2]
Joel Sikström
jsikstro at openjdk.org
Tue Oct 14 08:28:04 UTC 2025
On Tue, 14 Oct 2025 06:49:46 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Joel Sikström has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add comment
>
> Looks good, I see little risk with taking the patch as is. I had one suggestion for making `should_set_client_emulation_mode_flags` a bit more robust / less scary.
>
> Sidenote:
> `NeverActAsServerClassMachine` in the java.md seems to suggest that `MaxRAM` is "The maximum amount of memory that the JVM may use". While its section on `MaxRAM` explicitly says it is only for the java heap.
>
> Sidenote2:
> `NeverActAsServerClassMachine` and `AlwaysActAsServerClassMachine` seem very scewed. First that we allow them to be contradictory, `NeverActAsServerClassMachine` outweighs `AlwaysActAsServerClassMachine`, and we only care about `AlwaysActAsServerClassMachine` for the GC selection, but not the compiler. I wonder if the compiler also should have used `is_server_class_machine`. But regardless, the best thing is probably just to not change behaviour and hopefully be able to remove the flags in the future. At least consolidate them into one flag. Especially after JEP-523.
Thank you for looking at this @xmas92 and @stefank. I agree that it sounds like a good plan to make an effort to get rid of `Never/AlwaysActAsServerClassMachine`.
With this change we are able to more smoothly move forward with deprecating `MaxRAM` and `Never/AlwaysActAsServerClassMachine` separately, which I feel is a step in the right direction.
> src/hotspot/share/compiler/compilerDefinitions.cpp line 576:
>
>> 574: if (should_set_client_emulation_mode_flags()) {
>> 575: set_client_emulation_mode_flags();
>> 576: }
>
> Should there be a comment here which mentions that this decision has already been taken (and acted on) in `GCArguments::set_heap_size`?
>
> Someone that is not aware might start ergonomically changing flags between the first and second call to `should_set_client_emulation_mode_flags` which changes its decision.
>
> Alternatively `should_set_client_emulation_mode_flags` could be implemented as a set once property.
I've added a comment.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27765#issuecomment-3400680663
PR Review Comment: https://git.openjdk.org/jdk/pull/27765#discussion_r2428330915
More information about the hotspot-gc-dev
mailing list