RFR: 8369503: [Linux] Move machine-specific queries to the OSContainer layer [v2]

Severin Gehwolf sgehwolf at openjdk.org
Tue Jan 27 10:44:41 UTC 2026


On Tue, 27 Jan 2026 10:20:46 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:

>> Hi everyone,
>> 
>> In #27470, we removed most calls up to `os::Linux` from the container/cgroup layer. This PR finishes that work by removing the last few tricky ones. We had one call in `CgroupSubsystem::active_processor_count` and two calls in `CgroupUtil::adjust_controller`. These were harder to untangle because the call in `active_processor_count` was guarded by a cache, and `adjust_controller` was called in the v1/v2 controller constructors.
>> 
>> `CgroupSubsystem::active_processor_count` now takes a supplier function for the host CPU count, provided from `OSContainer`. The cache still decides if we call the supplied function, so we keep existing caching functionality.
>> 
>> For hierarchy adjustments, I moved the calls out of the cgroup constructors and into `OSContainer`'s initialization, with a new used helper function `CgroupSubsystem::adjust_controllers` that adjusts all controllers. After creating the cgroup subsystem, we adjust the controllers once from `OSContainer`, instead of doing it as the last step of the creation.
>> 
>> As a result from these changes, cgroup code no longer needs to include or call `os::Linux` functions.
>> 
>> Testing:
>> - Oracle tiers 1-5
>> - Local container tests on cgroup v1 and v2 on both Podman and Docker
>
> Casper Norrbin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
> 
>  - Merge branch 'master' into cgroupsubsystem-no-os-calls
>  - move os::linux calls out of cgroups

Marked as reviewed by sgehwolf (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/29188#pullrequestreview-3710432166


More information about the hotspot-runtime-dev mailing list