Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8227018

CompletableFuture should not call Runtime.availableProcessors on fast path

    XMLWordPrintable

Details

    Backports

      Description

        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 to JDK-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.

        Attachments

          Issue Links

            Activity

              People

                shade Aleksey Shipilev
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: