URGENT (XS) RFR: 8149697: Fix for 8145725 is broken
Kim Barrett
kim.barrett at oracle.com
Thu Feb 11 20:47:12 UTC 2016
> On Feb 11, 2016, at 3:37 PM, David Holmes <david.holmes at oracle.com> wrote:
>
> bug: https://bugs.openjdk.java.net/browse/JDK-8149697
>
> webrev: http://cr.openjdk.java.net/~dholmes/8149697/webrev/
>
> In the refactoring for 8145725 a check of _cur_index was moved outside the mutex block, but this was wrong as the value could be changed by a parking thread. As per the existing comment we needed to check the saved 'index' instead:
>
> --- old/src/os/linux/vm/os_linux.cpp 2016-02-11 15:23:59.696802390 -0500
> +++ new/src/os/linux/vm/os_linux.cpp 2016-02-11 15:23:57.440675175 -0500
> @@ -5756,7 +5756,7 @@
> int index = _cur_index;
> status = pthread_mutex_unlock(_mutex);
> assert_status(status == 0, status, "invariant");
> - if (s < 1 && _cur_index != -1) {
> + if (s < 1 && index != -1) {
> // thread is definitely parked
> status = pthread_cond_signal(&_cond[index]);
> assert_status(status == 0, status, "invariant");
>
> This could introduce spurious wakeups for a parking thread.
>
> Thanks,
> David
Looks good.
More information about the hotspot-runtime-dev
mailing list