-
Enhancement
-
Resolution: Fixed
-
P3
-
8u191
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8228423 | 8u241 | Sean Coffey | P3 | Resolved | Fixed | b01 |
JDK-8235031 | emb-8u241 | Aleksey Shipilev | P3 | Resolved | Fixed | team |
In 8u, CompletableFuture calls Runtime.availableProcessors during spin in waitingGet:
private Object waitingGet(boolean interruptible) {
...
while ((r = result) == null) {
if (spins < 0)
spins = (Runtime.getRuntime().availableProcessors() > 1) ?
1 << 8 : 0; // Use brief spin-wait on multiprocessors
Unfortunately, that falls victim toJDK-8227006, which makes it too costly. This is fixed in 9 with JDK-8134851, but that patch is too large and intrusive to backport to 8u. Therefore, we should consider backporting the small part of that patch that deals with availableProcessors handling.
private Object waitingGet(boolean interruptible) {
...
while ((r = result) == null) {
if (spins < 0)
spins = (Runtime.getRuntime().availableProcessors() > 1) ?
1 << 8 : 0; // Use brief spin-wait on multiprocessors
Unfortunately, that falls victim to
- backported by
-
JDK-8228423 CompletableFuture should not call Runtime.availableProcessors on fast path
- Resolved
-
JDK-8235031 CompletableFuture should not call Runtime.availableProcessors on fast path
- Resolved
- duplicates
-
JDK-8227019 CompletableFuture.waitingGet shouldn't call Runtime.availableProcessors in a tight loop
- Closed
- relates to
-
JDK-8134851 Integrate CompletableFuture with API enhancements
- Resolved
-
JDK-8227006 [linux] Runtime.availableProcessors execution time increased by factor of 100
- Resolved