RFR: 8365606: Container code should not be using jlong/julong [v3]

Severin Gehwolf sgehwolf at openjdk.org
Mon Nov 10 17:15:52 UTC 2025


On Wed, 22 Oct 2025 13:44:56 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:

>> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 21 commits:
>> 
>>  - Extract OSContainer::available_swap_in_bytes()
>>  - Simplify os::used_memory()
>>  - Fix os::active_processor_count()
>>  - os::free_memory => use 'value' directly
>>  - os::available_memory() => use 'value' directly
>>  - Fix pids_max printing in VM.info
>>  - Better logging for -1 (cpu_shares)
>>  - Fix cg v1 cpu_shares to match old behaviour
>>  - More comment fixes.
>>  - Drop -1 (unlimited) and -2 (failed) constants
>>    
>>    Will likely need corresponding test changes
>>  - ... and 11 more: https://git.openjdk.org/jdk/compare/d5803aa7...08f1c185
>
> src/hotspot/os/linux/os_linux.cpp line 348:
> 
>> 346:         return true;
>> 347:       }
>> 348:     }
> 
> This whole function is getting a bit too long in my opinion.
> Maybe everything inside the `if OSContainer::is_containerized() {}` could be moved into a new function   `OSContainer::available_swap_in_bytes`, similar to the already existing `OSContainer::available_memory_in_bytes`. That way, we could abstract away all the `OSContainer` calls.
> 
> The only consequence would be that the `log_trace` wouldn't work any more. I couldn't find any test that depends on the exact output, so it could perhaps be split up instead.

I've moved this to a `OSContainer::available_swap_in_bytes` function.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27743#discussion_r2511339099


More information about the hotspot-jfr-dev mailing list