(XS) RFR: 8148766: Test AvailableProcessors.java got wrong number of processors

Mikhailo Seledtsov mikhailo.seledtsov at oracle.com
Tue Feb 2 05:17:18 UTC 2016


Changed looks good to me,

Misha

On 2/1/2016 6:15 PM, David Holmes wrote:
> Bug: https://bugs.openjdk.java.net/browse/JDK-8148766
>
> webrev: http://cr.openjdk.java.net/~dholmes/8148766/webrev/
>
> It seems some (arguably ill-behaved) systems can use aggressive power 
> management to disable cores on the fly and at high frequency. As a 
> result even using taskset the number of processors reported as 
> available to the JVM can be less than what we asked for. This small 
> tweak to the test simply changes the success criteria to only see more 
> than the expected number of processors as an error.
>
> Thanks,
> David
>
> --- old/test/runtime/os/AvailableProcessors.java    2016-02-01 
> 21:14:07.721558368 -0500
> +++ new/test/runtime/os/AvailableProcessors.java    2016-02-01 
> 21:14:05.681443769 -0500
> @@ -27,7 +27,7 @@
>
>  /*
>   * @test
> - * @bug 6515172
> + * @bug 6515172 8148766
>   * @summary Check that availableProcessors reports the correct value 
> when running in a cpuset on linux
>   * @requires os.family == "linux"
>   * @library /testlibrary
> @@ -93,7 +93,9 @@
>
>      static void checkProcessors(int expected) {
>          int available = Runtime.getRuntime().availableProcessors();
> -        if (available != expected)
> +        // available can dynamically drop below expected due to 
> aggressive power management
> +        // but we should never have more than expected, else taskset 
> is broken
> +        if (available > expected)
>              throw new Error("Expected " + expected + " processors, 
> but found "
>                              + available);
>          else



More information about the hotspot-runtime-dev mailing list