On Fri, 19 Jun 2026 15:27:05 GMT, Jorn Vernee <[email protected]> wrote:
>> src/java.base/share/classes/jdk/internal/foreign/ConfinedSegmentPool.java >> line 369: >> >>> 367: return target <= 1 >>> 368: ? 1 >>> 369: : Integer.highestOneBit(target - 1) << 1; >> >> `availableProcessors` is guaranteed to return a number "never smaller than >> 1". So this conditional isn't needed since `target` will always be at least >> 2. >> Suggestion: >> >> return Integer.highestOneBit(target - 1) << 1; > > Also, maybe consider making the slot count configurable with a system > property. I'd imagine there are programs with many virtual threads that need > to allocate. The idea here is that the allocations would typically be short-lived. The carrier pool (for VTs) is by default the same capacity as `Runtime.getRuntime().availableProcessors()`, and we are using twice the amount of that for the pool. So, unless VTs are parked during allocations, the solution would likely scale over thousands of virtual threads. Adding a system property for this sounds reasonable. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31365#discussion_r3452875286
