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

Severin Gehwolf sgehwolf at openjdk.org
Wed Jan 14 15:51:25 UTC 2026


On Tue, 13 Jan 2026 10:53:47 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

This looks OK to me.

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

Marked as reviewed by sgehwolf (Reviewer).

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


More information about the hotspot-runtime-dev mailing list